Hash Collision Probability Calculator
The probability that two of N random hashes or identifiers collide, from the birthday paradox — and how many items you can generate before the risk reaches a level you choose.
With H possible values, the chance that N items include at least one collision is about 1 − e^(−N² ÷ 2H): it grows with the square of N, so a collision becomes likely around √H items, not H.
How the hash collision probability calculator works
With H possible values, the chance that N items include at least one collision is about 1 − e^(−N² ÷ 2H): it grows with the square of N, so a collision becomes likely around √H items, not H. A 32-bit hash is 50% likely to collide after 77,000 items; a 64-bit one after 5 billion; a 128-bit UUID needs 2.6 × 10¹⁹. Use the target-risk row to size an identifier.
Formula: P ≈ 1 − exp(−N(N − 1) ÷ (2 × 2ᵇ)); N for risk p ≈ √(2 × 2ᵇ × ln(1 ÷ (1 − p)))
Worked examples
| Inputs | Probability of at least one collision | Note |
|---|---|---|
| A million 64-bit hashes | 2.71e-8 | 2.7 × 10⁻⁸ — negligible |
| 100,000 32-bit hashes | 68.781% | 68.8% — expected |
| A billion random UUIDs | 9.40e-20 | 9.4 × 10⁻²⁰ |
FAQFrequently asked questions
Why does a collision come at the square root of the space?
Because every pair of items is a chance to collide, and there are N²/2 pairs. That is the birthday paradox: 23 people give a 50% chance of a shared birthday among 365 days.
Is a UUID safe?
A random v4 UUID has 122 random bits: you would need about 2.7 × 10¹⁸ of them for a 50% chance of a duplicate, and a billion a second for 85 years to get there. The risk in practice is a bad random-number generator, not the size.
What about deliberate collisions?
This calculator is about accidental collisions among random values. MD5 and SHA-1 are broken against attackers who craft collisions on purpose, which is a different problem — use SHA-256 or better for anything security-related.
How small a hash can I use for a lookup table?
Pick the risk you can tolerate and read the sizing row: for a million items and a 0.0001% risk you need about 60 bits, so a 64-bit hash is fine and a 32-bit one is not.
Where these figures come from
- IEC 80000-13 — Information science and technology (quantities and units) — the decimal (kB, MB) versus binary (KiB, MiB) prefixes used throughout
- RFC 4632 — Classless Inter-domain Routing (CIDR) — the address-plan arithmetic behind the subnet calculator
- RFC 1918 — Address Allocation for Private Internets — the private ranges the subnet calculator recognises
- NIST SP 800-63B — Digital Identity Guidelines, Authentication — length over composition rules; the basis of the password guidance here
- NIST SP 800-57 Part 1 — Recommendation for Key Management — key-strength comparisons used by the key-space calculator
- Australian Cyber Security Centre — Essential Eight — national guidance on passphrases and system hardening
Last checked: September 2026. Units follow the SI decimal convention (IEC 80000-13 defines the binary alternatives); network and security figures cite the defining standard.