Hash Collision Probability Calculator

Calculate collision odds for a hash or ID space using the birthday problem.

Please note: Reference calculations for development and study. Verify security-relevant figures — entropy, collision probability, crack times — against current guidance before relying on them, since attacker capability changes over time.

What the Hash Collision Probability Calculator does

Collisions become likely far sooner than intuition suggests. With 23 people in a room there is a 50% chance two share a birthday, and the same maths applies to hashes: a 50% collision chance arrives at roughly the square root of the hash space, not half of it.

Formula

  • p ≈ 1 − e^(−k² ÷ 2N), where N = 2^bits
  • For small p: p ≈ k² ÷ 2N
  • 50% chance at k ≈ 1.177 √N
  • Collision resistance = bits ÷ 2

Inputs explained

InputUnitRequiredNotes
Hash or ID sizeone of 8 optionsYes
Custom bit lengthnumberIn some modesAccepts 1 or more, up to 1024. Shown Hash or ID size is Custom bit length.
Number of items hashedtextYesScientific notation works, such as 1e9 for a billion.

How to use it

  1. Choose Hash or ID size.
  2. Enter Number of items hashed.
  3. Fill in the remaining inputs the form shows for your choice.
  4. Select Calculate.

Worked example

Hashing a billion items into a 128-bit space.

Hash
128-bit (MD5, UUID)
Items
1e9

N = 3.4 × 10³⁸ and k² = 10¹⁸, so p ≈ 1.47 × 10⁻²¹ — negligible. A 50% chance would need about 2.2 × 10¹⁹ items.

Frequently asked questions

Why is collision resistance only half the hash length?

Because of the birthday bound. You are not looking for one specific match but any pair among k items, and there are k(k−1)/2 pairs — so the threshold arrives at √N rather than N.

Are UUID v4 collisions something to worry about?

No. With 122 random bits you would need roughly 2.7 × 10¹⁸ UUIDs for a 50% chance. Generating a billion a second, that is still tens of years.

Related calculators