Hash Collision Probability Calculator
Apply the birthday bound to any digest length: collision probability at your item count and the safe volume per digest.
Inputs
Collision Probability (log₁₀)
-20.83
−9 means about one chance in a billion.
Collision Probability
0.000000%
Expected Colliding Pairs
0.0000
Items for a 50% Chance (log₁₀)
19.34
Items at a 2⁻³² Risk Target (log₁₀)
14.60
Assessment
Safe — collision risk below 2⁻³² at 128 bits
Step by step
Values used
Digest length = 128-bit (MD5, truncated SHA-256); Distinct items hashed = 1,000,000,000 items
Hash Collision Probability
p ≈ 1 − e^(−k² ÷ 2N) with N = 2^b; for small p this is just k² ÷ 2^(b+1).
Birthday bound
50% collision point ≈ 1.1774 × √N = 1.1774 × 2^(b ÷ 2).
Collision Probability (log₁₀)
= -20.83
Collision Probability
= 0.000000
Expected Colliding Pairs
= 0.0000
Items for a 50% Chance (log₁₀)
= 19.34
Items at a 2⁻³² Risk Target (log₁₀)
= 14.60
Assessment
= Safe — collision risk below 2⁻³² at 128 bits
How it works
Collisions depend on the number of pairs, which grows as k² ÷ 2, so the risk crosses 50% at roughly the square root of the digest space — 2^64 items for a 128-bit digest. Expected colliding pairs is the same ratio without the exponential, which is the more useful figure once the probability is tiny. Truncating a hash to fit a database column or a short URL is where this bites: a 64-bit fingerprint collides with even odds after only 5 billion items, which is well inside the range of a real content-addressed store.
Formulas
Hash Collision Probability
p ≈ 1 − e^(−k² ÷ 2N) with N = 2^b; for small p this is just k² ÷ 2^(b+1).
- k
- Number of distinct items hashed
- b
- Digest length in bits
- N
- 2^b, the size of the digest space
Birthday bound
50% collision point ≈ 1.1774 × √N = 1.1774 × 2^(b ÷ 2).
Frequently Asked Questions
How is Hash Collision Probability calculated?
p ≈ 1 − e^(−k² ÷ 2N) with N = 2^b; for small p this is just k² ÷ 2^(b+1). Collisions depend on the number of pairs, which grows as k² ÷ 2, so the risk crosses 50% at roughly the square root of the digest space — 2^64 items for a 128-bit digest. Expected colliding pairs is the same ratio without the exponential, which is the more useful figure once the probability is tiny.
Why does Hash Collision Probability matter?
Truncating a hash to fit a database column or a short URL is where this bites: a 64-bit fingerprint collides with even odds after only 5 billion items, which is well inside the range of a real content-addressed store.
What values do I need to enter?
This calculator takes 2 inputs: Digest length, Distinct items hashed. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Why is SHA-1 considered broken if the birthday bound is 2^80?
The birthday bound is the generic limit. SHA-1's internal structure allows a chosen-prefix collision at about 2^63 work, which was demonstrated in 2019 for roughly $45,000 of cloud compute. Cryptanalysis, not the birthday bound, is what retired it.
How short can a content hash safely be?
Aim for at least twice the log₂ of your maximum item count plus 32 bits of margin. For a trillion objects (2^40) that means 112 bits or more — in practice, truncate SHA-256 to 128 bits.