Every system that uses UUIDs rests on one quiet assumption: two values generated independently, on different machines, at the same moment, will not be the same value. There is no central registry. Nobody phones a server to ask whether a fresh identifier is taken. So the question deserves a straight answer: can two UUIDs ever be the same?
The honest answer is yes, in principle, and anyone who tells you it is impossible is rounding off the truth. What makes UUIDs work is not impossibility; it is a probability so small that building on it is safer than most other assumptions the system makes. This guide works through the numbers, including the birthday paradox, which makes collisions arrive sooner than intuition expects, and shows why even the corrected numbers leave the risk effectively at zero. You can generate your own values as you read with the UUID Generator on Ovatly.
Contents
- Quick answer
- Where the randomness lives: 122 bits
- The honest maths of a collision
- The birthday paradox, and why it still does not save the worry
- How the generator produces values
- Limitations: where collisions really come from
- Common mistakes
- FAQs
- Conclusion
Quick answer
Yes, in principle: each version 4 UUID is a random draw, and a random draw can repeat. What stops it happening is the size of the space, 122 random bits giving about 5.3 x 10^36 possible values. Even after the birthday paradox correction, you would need roughly 2.7 x 10^18 UUIDs before a collision became more likely than not, and at a billion per second that is about 86 years of generation. The UUID Generator draws from your browser's cryptographic random source, the other half of why this works.
Where the randomness lives: 122 bits
A UUID is 128 bits long, written as 32 hexadecimal digits. Not all of those bits are random. Every generated value follows the pattern xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, and two positions are fixed markers: the 4 that opens the third group records the version, and the opening digit of the fourth group, one of 8, 9, a or b, records the variant. Those markers cost a few bits; what remains is 122 bits that are purely random.
122 random bits means 2^122 possible values, about 5.3 x 10^36, a number with 37 digits. That is vastly larger than the number of seconds since the universe began, and larger than the count of identifiers every database on earth will ever need, many times over.
Each value the generator produces is one independent draw from that space. Generating a value does not narrow the space for the next draw. The thousandth UUID you generate has the same chance of matching an earlier one as the second did, which is why the real question is how the probabilities accumulate.
The honest maths of a collision
Start with the simplest case. You have one UUID. You generate a second. The chance it matches the first is one in 5.3 x 10^36. That is the number people have in mind when they call collisions impossible, and it is essentially zero.
But real systems do not generate two UUIDs. They generate millions or billions, and every new value is compared against every value that came before it. The chance of a collision somewhere grows faster than the raw count, because the number of pairs grows with the square of the count. This is the same effect that makes shared birthdays so common. The next section does that maths.
Even with that correction, look at where the numbers land. Generate a trillion UUIDs, 10^12, more than most systems will ever hold. The chance that any two of them collide is about 9.4 x 10^-14, roughly one in ten trillion. And as the tool's documentation puts it, you would need to generate billions per second for years to expect one collision. Possible and expected are very different words.
The birthday paradox, and why it still does not save the worry
The birthday paradox says that in a room of just 23 people, the chance two of them share a birthday is already about 50 percent, because 23 people form 253 pairs and every pair is a chance to match. Applied to UUIDs, the same square-root effect means the collision chance reaches about 50 percent after roughly 2.7 x 10^18 values, far fewer than the full 5.3 x 10^36 space.
2.7 x 10^18 is 2.7 billion billion. At a billion UUIDs per second, reaching it takes about 86 years. At a million per second, a realistic ceiling for one busy system, it takes about 86,000 years. And that buys you a coin flip, a 50 percent chance of one collision somewhere in that ocean of identifiers, not a certainty. Every real deployment operates far below these scales, where entirely different failure modes dominate.
How the generator produces values
The maths above assumes each UUID is an independent, uniform draw from the full 122-bit space. That assumption is where the generator matters. The UUID Generator creates version 4 UUIDs with your browser's cryptographic random source, the class of randomness used for security-sensitive work, rather than a predictable pseudo-random function. Predictability is what would break the model: a weak random source can revisit the same neighbourhood of the space, and then collisions stop being a 10^-14 story.
Using the tool is plain. Choose how many UUIDs you need, from 1 to 100, press Generate UUIDs, then copy one value or use Copy all to take the whole list, one per line. Batches of 100 are instant because generation happens locally in your browser, and nothing is stored: the values exist only in the page until you close it. Generating again produces a fresh, independent batch.
Limitations: where collisions really come from
The collision risk from honest random generation is the smallest risk in the room. The duplicates that occur in production systems come from process failures, not probability. Code that copies a row and forgets to mint a new identifier. A seed file or test fixture, full of fixed sample UUIDs, loaded into more than one environment. A restore that replays old data into a system that kept generating. In each case the value was not drawn twice; it was carried twice.
One boundary on the generator's side: these are version 4, random, UUIDs. If you need time-ordered identifiers, the tool's notes point you to UUID v7 in a dedicated library. And a UUID is an identifier, not a credential: it works as an unguessable identifier, but for API keys or passwords a dedicated generator gives you more entropy and control over the character set.
Common mistakes
- Saying collisions are impossible. They are possible. The defensible claim is that the probability is negligible, and overstating it undermines the real argument.
- Ignoring the birthday paradox. Quoting one in
5.3 x 10^36as the collision chance for a whole system understates how pairs accumulate. Use the square-root scale, and the conclusion still holds. - Blaming randomness for process duplicates. When a duplicate UUID appears in a real database, the cause is almost always a copied row, a fixture or a restore, not two random draws.
- Treating a UUID as a secret. Unguessable is not the same as designed-for-credentials. Keep identifiers and passwords in their separate lanes.
FAQs
Can two version 4 UUIDs ever be identical? In principle, yes. Nothing in the format forbids the same random draw happening twice. In practice the chance is so small that the whole industry treats version 4 UUIDs as unique. The honest statement is practically guaranteed, never mathematically guaranteed.
How many possible version 4 UUIDs are there? A version 4 UUID has 122 random bits, so there are 2 to the power of 122 possible values, about 5.3 x 10^36. The remaining bits of the 128 are the fixed version and variant markers.
How many UUIDs would you need before a collision becomes likely? Because of the birthday paradox, the chance reaches about 50 percent after roughly 2.7 x 10^18 values, the square root scale of the full space. At a billion UUIDs per second, generating that many would take about 86 years of nonstop work.
Are the UUIDs from this generator guaranteed unique? Version 4 UUIDs carry 122 random bits. The chance of an accidental duplicate is so small that the whole industry treats them as unique; you would need to generate billions per second for years to expect one collision.
Does generating UUIDs in batches change the collision risk? No, not in any way that matters. The generator makes from 1 to 100 values at a time, and every value is an independent draw from the same 122-bit space. A batch of 100 set against about 5.3 x 10^36 possibilities does not move the probability in any measurable way.
Conclusion
Two UUIDs can be the same the way a coin can land on its edge: the physics allows it, and no sane plan depends on it either way. With 122 random bits, a cryptographic random source, and collision odds that need billions of values per second across decades to become a coin flip, duplication is the least likely failure your system has. Generate what you need with the UUID Generator, in singles or batches of up to 100, and spend your worry on the process errors that actually cause duplicates. If you are looking at a UUID someone handed you and wondering whether it is shaped correctly, the companion guide, How to Validate a UUID Format, walks the checks.
More tools for this kind of work live in the Developer Tools archive.