Paritian

Developers

ID Collision Probability Calculator (UUID, Random Tokens)

Chance that two randomly generated identifiers — UUIDs, tokens, short codes — come out the same, and how many you can make before that becomes likely.

Results

Chance of at least one collision 9.40395e-18 %
IDs for a 50 % chance of a collision 2.71492e+18
IDs for a one-in-a-billion chance 103,120,434,281,000

What this tool does

This is the birthday problem at scale: collisions become likely long before you have used up the possible values, at around the square root of their number. A version-4 UUID has 122 random bits, so you would need about 2.7 × 10¹⁸ of them for an even chance of a duplicate — but a 32-bit random ID reaches 50 % after only about 77 000. The approximation is excellent for any realistic case and assumes a good random generator; a weak or badly seeded one collides far sooner.

Formula

p ≈ 1 − e^(−n(n − 1) ÷ (2 × 2^bits)) · 50 %: n ≈ 1.1774 × 2^(bits/2)

Variables

SymbolMeaningUnit
biRandom bits in each IDbits
nIDs generated—
PChance of at least one collision%
N5IDs for a 50 % chance of a collision—
N9IDs for a one-in-a-billion chance—

Worked example

  • Random bits in each ID122 bits
  • IDs generated1,000,000,000
  • Chance of at least one collision9.40395e-18 %
  • IDs for a 50 % chance of a collision2.71492e+18
  • IDs for a one-in-a-billion chance103,120,434,281,000

Limitations

  • The result is an estimate based only on the values you type. Real situations often include factors this calculator does not know about.
  • The calculation runs at full precision and only the display is rounded. If you copy an intermediate value and retype it, small differences can appear.