UUID versions, side by side
Eight layouts share one shape. v4 is chance, v7 is a clock plus chance, v3 and v5 are hashes of a name, v1 and v6 are a clock plus a machine, v8 is whatever you define, and Nil and Max are constants with no version at all.
The version nibble picks a layout, and the layouts have almost nothing in common beyond the six bits that name them. This page puts all of them in one table so the choice takes a minute rather than an afternoon.
0c5b2444-70a0-4932-980c-b4dc0d3f02b5outuuid · RFC 9562 (10xx) · version 4Random
01890a5d-ac96-774b-bcce-b302099a8057outuuid · RFC 9562 (10xx) · version 7Time-ordered
cfbff0d1-9375-5685-968c-48ce8b15ae17outuuid · RFC 9562 (10xx) · version 5SHA-1 of the DNS namespace and example.com
00000000-0000-0000-0000-000000000000outuuid · NCS (0xxx) — reserved, backward compatibility · no version · nil, palindromeNil: no version, no variant
On this page (7)
The whole table#
| Version | Made from | Sorts by time | Reveals | Reach for it when |
|---|---|---|---|---|
| v1 | 60-bit clock since 1582 + node | no | creation time, often the MAC | you are reading identifiers from an older system |
| v2 | DCE Security: clock, local domain and id | no | a POSIX UID or GID | never, unless DCE asks |
| v3 | MD5 of a namespace and a name | no | nothing, but the name is guessable | you need determinism and MD5 is already the convention |
| v4 | 122 random bits | no | nothing | you need an identifier and nothing more |
| v5 | SHA-1 of a namespace and a name | no | nothing, but the name is guessable | the same input must always give the same identifier |
| v6 | the v1 clock, reordered | yes | creation time, often the MAC | you already generate v1 and want ordering |
| v7 | 48-bit Unix ms + 74 random bits | yes | creation time to the millisecond | it is a database key, which is the usual case |
| v8 | whatever you define | if you design it that way | whatever you put in it | you need custom structure in a valid UUID |
| Nil | all zeros | — | nothing | you need an obvious placeholder |
| Max | all ones | — | nothing | you need an upper bound for a range query |
RFC 9562 § 5 · UUID LayoutsEvery layout in the standard, in one section
Where the version actually lives#
Bits 48 to 51 hold the version: the 13th hex digit, first character of the third group. Bits 64 and 65 hold the variant at the top of the 17th digit. An identifier whose 17th digit is 8, 9, a or b belongs to RFC 9562; anything else is NCS, Microsoft or reserved, and its version nibble means nothing.
RFC 9562 § 4.2 · Version FieldThe version field
Version 2 is real, and you will not use it#
DCE Security identifiers give time_low to a local id, a POSIX UID or GID, and half the clock sequence to a local domain. What remains is a coarse, partial timestamp. RFC 9562 documents the layout for completeness; almost no library generates it, and most decoders report it as unknown.
RFC 9562 § 5.2 · UUID Version 2The v2 layout, which most tools quietly ignore
The standard moved in 2024#
RFC 9562 replaced RFC 4122 in May 2024. Versions 1 to 5 are unchanged; v6, v7, v8 and the Max UUID are new. A page that describes UUID versions and cites RFC 4122 is describing a document that never mentioned a time-ordered layout. Worth remembering when comparing sources.
- RFC 9562 — the current standardObsoletes RFC 4122
- ITU-T X.667 / ISO-IEC 9834-8The same identifier as an international standard
Questions people actually ask#
Which UUID version should I use?
v7 for database keys, v4 when you only need uniqueness, v5 when the identifier must be derived from a name. Everything else is for compatibility with an existing system.
Why is there no version 2 in most libraries?
v2 is DCE Security. It spends fields on a POSIX UID and a local domain, is rarely useful outside DCE, and most implementations skipped it.
Do Nil and Max UUIDs have a version?
No. All zeros and all ones set neither a valid version nor the RFC variant, which is exactly what makes them unmistakable as placeholders.
Related#
Browse the reference
Start here
Making and converting in bulk
Converting a UUID
Reading one
The versions, in order
In a database
ULID and the alternatives
Running the tool