Skip to content
100% in your browser. Nothing you paste is uploaded — all processing runs locally. Read more →

What is a UUID?

On this page
  1. What they look like
  2. Why 128 bits?
  3. What makes a UUID a UUID
  4. The versions, briefly
  5. Why use UUIDs at all?
  6. When to use which form
  7. How this generator works
  8. Further reading

A UUID — Universally Unique Identifier — is a 128-bit number used to identify something without coordinating with a central authority. Two systems on opposite sides of the planet can independently generate UUIDs and never collide. That’s the whole magic.

Microsoft calls them GUIDs. They’re the same thing — see UUID vs GUID.

What they look like

A UUID is almost always written as 32 hexadecimal digits in five hyphen-separated groups:

550e8400-e29b-41d4-a716-446655440000

That’s 8-4-4-4-12 hex characters, or 128 bits in total. The format is defined by RFC 4122 and updated by RFC 9562.

Why 128 bits?

The whole point of a UUID is that you can generate one without checking with a central server. To make that safe, the value needs enough bits that random generation is essentially collision-free.

128 bits gives you 2¹²⁸ ≈ 3.4 × 10³⁸ possible values. Even after generating a billion UUIDs per second for a hundred years, the chance of producing two identical ones is still vanishingly small. (See UUID collision probability for the math.)

What makes a UUID a UUID

Two specific bit ranges in the 128 bits are reserved as metadata:

In 550e8400-e29b-41d4-a716-446655440000:

These metadata bits are what make a UUID a UUID. They also mean only 122 of the 128 bits are actually random in a v4 UUID — the other 6 are fixed.

The versions, briefly

There are eight defined versions; you’ll encounter four in practice.

VersionWhat it encodesUse when
v1Timestamp + node ID (originally MAC)Legacy interop only
v3MD5(namespace + name)Deterministic IDs from stable inputs
v4122 random bitsThe default — when you just need an ID
v5SHA-1(namespace + name)v3 but better; pick this for new code
v7Unix-ms timestamp + randomDatabase primary keys (modern default)
nilAll zerosSentinel / placeholder

If you don’t have a specific reason, use v4 for one-off IDs and v7 for primary keys.

Why use UUIDs at all?

Compared to integer IDs (1, 2, 3, …), UUIDs trade compactness for independence:

The cost: 16 bytes per ID instead of 4 or 8, slightly worse cache behavior, and harder-to-read URLs. Most modern systems decide the trade-off is worth it.

When to use which form

How this generator works

The generator on this site uses your browser’s native crypto.randomUUID() for v4 (a CSPRNG-backed implementation built into every modern browser) and the uuid npm package for v1, v3, v5, and v7. Generation runs entirely client-side — nothing leaves your machine.

Further reading