Hash Collision Probability
Enter the hash size in bits and item count to get the collision probability via the birthday-problem approximation.
Parameters
Common: MD5 = 128, SHA-1 = 160, SHA-256 = 256, SHA-512 = 512
How many distinct hashes exist in your dataset
Collision Probability
—
0%25%50%75%100%
Enter values above
Hash space
—
Items (n)
—
n / √H ratio
—
Details
50% collision threshold (≈ 1.177 × √H)
—
1% collision threshold
—
Expected collisions at n items
—
Birthday attack cost (ops to 50%)
—
Summary
Enter the hash size in bits and item count to get the collision probability via the birthday-problem approximation.
How it works
- Enter the hash output size in bits (e.g. 256 for SHA-256, 128 for MD5).
- Enter the number of items (hashes) that will be in your dataset.
- The tool computes the hash space H = 2^bits and applies the approximation P ≈ 1 − e^(−n² / 2H).
- Review the collision probability, expected first-collision threshold, and safety margin.
- Adjust either value to explore different scenarios interactively.
Use cases
- Assess collision risk when choosing a hash length for a database or cache key scheme.
- Understand why SHA-1 (160 bits) is considered weak at scale vs SHA-256 (256 bits).
- Estimate when birthday attacks become practical against a given hash function.
- Teach the birthday paradox in cryptography or probability courses.
- Verify that a UUID or random token space is large enough for your expected volume.
- Compare 32-bit, 64-bit, and 128-bit hash spaces for non-cryptographic hashing.
Frequently Asked Questions
Last updated: 2026-06-11 ·
Reviewed by Nham Vu