UUID Cheat Sheet

How a UUID is built, what each version contains, which one to use, and how to make one in your language.

Cheat sheetPrintableFree, no login

Updated 28 October 2026

Generate v4 or v7 UUIDs in bulk, or decode any UUID's version and timestamp.

Open the UUID generator

UUID format

123e4567-e89b-42d3-a456-426614174000
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
               │    └─ variant: 8, 9, a or b for standard UUIDs
               └────── version: 1–8

UUID versions

VersionMade fromExampleUse it for
v1Timestamp + node (MAC)C232AB00-9414-11EC-B3C8-9F6BDECED846Legacy. Leaks creation time and can leak the MAC addressTry ↗
v3MD5 hash of namespace + name5df41881-3aed-3515-88a7-2f4a814cf09eSame name always gives the same UUID. Prefer v5Try ↗
v4122 random bits919108f7-52d1-4320-9bac-f847db4148a8General purpose. The most common versionTry ↗
v5SHA-1 hash of namespace + name2ed6657d-e927-568b-95e1-2665a8aea6a2Deterministic IDs, e.g. one ID per URL or emailTry ↗
v6v1 reordered so it sorts by time1EC9414C-232A-6B00-B3C8-9F6BDECED846Only when migrating from v1; otherwise use v7Try ↗
v7Unix milliseconds + random017F22E2-79B0-7CC3-98C4-DC0C0C07398FDatabase keys — sorts by creation timeTry ↗
v8Custom layout2489E9AD-2EE2-8E00-8EC9-32D5F69181C0Your own format inside the UUID shapeTry ↗

The v3 and v5 examples are the UUIDs for the name www.example.com in the DNS namespace. Version 2 (DCE security) is reserved and almost never used. Try ↗ decodes the example in the UUID checker, including the creation time inside v1, v6 and v7.

Special UUIDs

NameValueMeaning
Nil UUID00000000-0000-0000-0000-000000000000"No UUID" — an empty value
Max UUIDffffffff-ffff-ffff-ffff-ffffffffffffUpper bound, e.g. for ranges
DNS namespace6ba7b810-9dad-11d1-80b4-00c04fd430c8For v3 and v5 names that are domain names
URL namespace6ba7b811-9dad-11d1-80b4-00c04fd430c8For v3 and v5 names that are URLs

Which version should I use?

Generate UUIDs in code

LanguageRandom (v4)Time-ordered (v7)
JavaScriptcrypto.randomUUID()v7() from the uuid npm package
Pythonuuid.uuid4()uuid.uuid7() (Python 3.14+)
JavaUUID.randomUUID()a library such as uuid-creator
C# (.NET)Guid.NewGuid()Guid.CreateVersion7() (.NET 9+)
Gouuid.New() (google/uuid)uuid.NewV7() (google/uuid)
PostgreSQLgen_random_uuid()uuidv7() (PostgreSQL 18+)
MySQLUUID() gives v1, not v4—
Command lineuuidgen—

Store UUIDs in a native uuid column or as 16 bytes (BINARY(16)), not as 36-character text.

Frequently asked questions

Can two UUIDs be the same?
In theory yes, in practice no. A v4 UUID has 122 random bits: you would need about 2.7 × 1018 UUIDs for a 50% chance of a single duplicate.
What is the difference between a UUID and a GUID?
Nothing meaningful — GUID is Microsoft's name for a UUID. GUIDs are often shown in uppercase inside braces, and Windows stores the first three groups in a different byte order in binary form.
Which UUID version should I use?
v4 for general unique IDs, v7 for database keys because it sorts by creation time, and v5 when the same input must always produce the same ID.
Is a UUID secure enough for a password-reset token?
A v4 UUID from a good random source is hard to guess, but it's better to use a purpose-made random token with at least 128 bits and an expiry. Never use v1 or v7 for secrets — part of them is a timestamp.
How long is a UUID?
128 bits: 32 hex digits, or 36 characters with the four hyphens.
✓ Copied!