Skip to content

UUID generator

Generate version 4 UUIDs using your browser's cryptographic randomness.

Runs in your browser — nothing is sent anywhere.

What a UUID is

A 128-bit identifier written as 32 hexadecimal digits in five hyphen-separated groups. The point of it is that anyone, anywhere, can generate one without coordinating with anyone else and be confident it has never been generated before.

This produces version 4 UUIDs — 122 random bits, with six bits fixed to mark the version and variant. You can identify one by eye: the fourteenth hex digit is always 4.

On collisions

122 random bits is roughly 5.3 × 10³⁶ possibilities. Generating a billion per second for a century leaves the probability of a single collision negligible. In practice, duplicate UUIDs come from broken generators — code that used a non-cryptographic random source, or a virtual machine cloned along with its seed — not from exhausting the space.

These come from crypto.randomUUID where available, falling back to the browser's cryptographic generator.

UUIDs as database keys

Worth knowing before you commit to them. Random UUIDs make excellent primary keys for distributed systems, since clients can generate them without a round trip. They are poor clustered index keys in a database, because random values scatter inserts across the index and fragment it — an effect that is invisible at a thousand rows and expensive at ten million.

If that matters, look at UUIDv7, which puts a timestamp in the high bits so values sort by creation time while staying unique.

Formatting

Lowercase with hyphens is the canonical form. Braces are the Microsoft convention and appear in .NET and Windows registry contexts; uppercase turns up in older systems. All three represent the same value.

01

Common questions

Can two UUIDs collide?

The probability is negligible. Real-world duplicates come from broken generators, not from exhausting the space.

What is version 4?

122 random bits with the version and variant fixed. The fourteenth hex digit is always 4.

Are UUIDs good database keys?

Excellent for distributed generation, poor as clustered index keys because random values fragment the index. Consider UUIDv7.

Is this random enough?

Yes. It uses crypto.randomUUID or the browser's cryptographic generator, never Math.random.

Are they generated on your server?

No. Everything happens in your browser.