Skip to content

UUID Generator

Generate version 4 UUIDs in your browser, laid out exactly as RFC 9562 prescribes. Nothing leaves the page.

text

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where y is one of 8, 9, a, b

A version 4 UUID is 122 random bits dressed up in a fixed layout. Six of the 128 bits are not random at all: four say which version this is, two say which variant. That is why every v4 identifier you have ever seen has a 4 in the same place and one of 8, 9, a or b right after the third hyphen — those two characters are the giveaway that something really is a v4 and not a random hex string of the right length.

How it is calculated

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where y is one of 8, 9, a, b

The generator fills every other position from the browser random source and pins the version and variant positions to the values the RFC requires. The odds of two draws colliding are governed by those 122 random bits, not by the full 128.

Source: RFC 9562 — UUIDv4 is meant for generating UUIDs from truly random or pseudorandom numbers: 122 random bits, the version field set to 0b0100 and the variant field set to 0b10

Questions people ask

Is a UUID and a GUID the same thing?
In practice yes. GUID is the name Microsoft used and it stuck in the .NET and Windows world; UUID is the name in the RFC. The layout is identical, so an identifier generated here drops straight into a system that asks for a GUID.
Can two of these ever be the same?
It is possible and it will not happen to you. With 122 random bits you would need to generate billions of identifiers per second for decades before a collision became likely. What does cause collisions is a weak random source — which is why the RFC asks for a cryptographically secure one.
Why not just use a database counter?
Counters need a single authority to hand out the next number. UUIDs do not, which is the whole point: two machines that have never spoken can each mint identifiers that will not clash. The cost is size and the loss of any natural ordering.
What about the other versions?
Version 1 encodes a timestamp and a MAC address, which leaks where and when it was made. Versions 6 and 7 keep the time ordering that makes database indexes happy without leaking hardware. Version 4 is the one to reach for when you want nothing but randomness.

Found a problem, or want more?

A number that disagrees with its source is a defect, not a rounding preference.

What did you enter, what did the tool show, and what did you expect instead? If you have a source that disagrees with ours, a link to it is the most useful thing you can send.

Write to us

Opens your mail app with the page and tool already filled in.

Related tools