How unique are UUIDs?

We all use UUIDs. They're amazing for quick unique IDs. But how unique are they? Let's find out.

A UUID v4, with its 128-bit composition and 122 randomly generated bits, has an immense range of unique possibilities — approximately 5.3x10^36, or over 5 undecillion. While the probability of generating an identical UUID is not zero, it's so infinitesimally small that for any practical application, a UUID can be considered effectively unique.

Let's consider a comparison to further appreciate this scale. If every one of the approximately 8 billion people on Earth generated one billion UUIDs per second, it would take well over a trillion years before the probability of producing a single duplicate UUID would surpass one in a billion. That's more than 70,000 times the estimated age of the universe, which is roughly 13.8 billion years.

Imagine if we could materialize each UUID as a grain of sand. The total possible UUIDs would not only inundate the Earth's beaches but could also fill every corner of the Milky Way and an additional billion galaxies. Even then, you'd still be nowhere near exhausting the unique UUIDs available.

The probability of generating a duplicate UUID is so small that it becomes more likely that the Earth will be destroyed by an asteroid impact in the next 100 years than that a duplicate UUID will be generated in the next 100 years.

So, TL;DR, UUIDs are unique. Very unique. So unique that you don't have to worry about them being duplicated. Ever.

You can play around with UUIDs in our UUID generator tool, and see for yourself how unique the different versions of UUIDs are.

Recommended Reading