Hash Collision Probability Calculator

Find out whether your IDs are long enough, from short codes and 64-bit hashes to UUIDs, using the birthday paradox maths.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Choose an ID type

    Or enter the bits.

  2. 2
    Enter the item count

    Total you will create.

  3. 3
    Enter the rate

    Items per second.

  4. 4
    Pick an acceptable risk

    One in a million is common.

  5. 5
    Read the probability

    And the safe item count.

  6. 6
    Compare formats

    Choose a long enough ID.

About this tool

How likely is it that two random identifiers are the same? The answer is far higher than intuition suggests, which is the birthday paradox: in a room of only 23 people, there is a 50% chance that two share a birthday. The same maths decides whether a short URL code, a 32-bit hash, a session token or a UUID is safe from accidental duplicates. This calculator applies the birthday bound to any ID size. Choose a common format, such as CRC-32, a 64-bit hash, a short Git commit id, a YouTube-style 11-character id, NanoID, UUID v4, MD5, SHA-1 or SHA-256, or enter the number of random bits. Enter how many items you have and it gives the probability of at least one collision. Choose an acceptable risk, such as one in a million, and it tells you how many items you can create before reaching it and, given how many you generate per second, how many days or years that takes. A comparison table shows the same figures for every common format, so you can pick an ID length with confidence.

The birthday bound

For N possible values and k items, the chance of at least one collision is approximately 1 − e^(−k(k−1)/2N). A rule of thumb follows: collisions become likely (about 50%) after roughly the square root of N items. A 32-bit hash has about 4.3 billion values, so collisions are likely after only about 77,000 items.

What the numbers mean

- 32 bits: fine for detecting corruption, useless as a unique id at scale. - 64 bits: collisions likely after about 5 billion items; acceptable for many caches, not for global identifiers. - 122 bits (UUID v4): you could generate a billion per second for about 86 years before a 50% chance of one collision. - 256 bits (SHA-256): collisions are not a practical concern.

Accidental versus deliberate

The calculation assumes random, uniformly distributed values. Poor random number generators, truncated hashes and sequential components make collisions far more likely. It also concerns accidents only: MD5 and SHA-1 can be deliberately collided by attackers, so never use them where someone could choose the input, such as signatures or certificates.

Choosing an ID length

Decide how many items you will ever create, pick an acceptable risk (one in a million or one in a billion are common), and choose a format whose capacity comfortably exceeds it. If a collision would be harmful rather than inconvenient, also enforce uniqueness with a database constraint.

Limits

Results use floating-point approximations accurate for realistic sizes; extremely small probabilities are reported as below 10⁻¹⁵. This is an engineering estimate, not a security proof.

Worked example

One billion UUID v4 values have a collision probability below 10⁻¹⁵, and you could create about 3.3 quadrillion before a one-in-a-million risk; with a 32-bit hash, a 50% chance of a duplicate arrives after only about 77,000 items.

Quick facts

Frequently asked questions

What is the birthday paradox?

Collisions become likely after about the square root of the number of possible values.

Can two UUIDs be the same?

In theory yes, in practice the chance is negligible for random v4 UUIDs.

Are short Git hashes safe?

Seven hex digits collide in large repositories; Git lengthens them when needed.

Is a 64-bit hash enough?

For millions of items usually; for billions, collisions become likely.

Does this cover attacks?

No. It covers random collisions only; use collision-resistant hashes against attackers.

Is anything uploaded?

No. Calculations run in your browser.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages