Almanac of UUIDs · Part III

Structural Anatomy and Mechanics

3.1 The Canonical Text Representation

Regardless of the version, a standard UUID is represented as a 32-character hexadecimal string, divided into five groups by hyphens (8-4-4-4-12).

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

Format: 8-4-4-4-12 (36 chars total)

GroupNameSize (Hex)Size (Bits)Description
1time_low832The low 32 bits of the timestamp (or random data).
2time_mid416The middle 16 bits of the timestamp (or random data).
3time_hi_and_ver416High 12 bits of timestamp + 4-bit Version.
4clk_seq_hi_res416High bits contain Variant; rest is clock seq.
5node1248Node identifier (MAC address or random).

3.2 The Variant Field (N)

The Variant bits determine the layout of the rest of the UUID. They are located in the most significant bits of the 9th byte (the first digit of the 4th group, Nxxx).

  • 0xxx (0-7): Reserved (NCS) - Backward compatibility with Apollo.
  • 10xx (8, 9, A, B): RFC 9562 / DCE 1.1 - The standard layout (v1-v8).
  • 110x (C, D): Microsoft COM - Legacy GUIDs.
  • 111x (E, F): Reserved - Future definition.

Implication: When generating or validating standard UUIDs, the N digit must always be 8, 9, A, or B.

3.3 The Version Field (M)

The Version bits specify the algorithm used to generate the UUID. They are located in the most significant bits of the 7th byte (the first digit of the 3rd group, Mxxx).

v1: Time-based

Gregorian Time + MAC Address

v2: DCE Security

Gregorian Time + POSIX UID

v3: Name-based (MD5)

Hash of Namespace + Name

v4: Random

122 bits of randomness

v5: Name-based (SHA-1)

Hash of Namespace + Name

v6: Reordered Time

Sortable v1

v7: Unix Epoch

Unix ms + Random (Modern Standard)

v8: Custom

Vendor-defined payload

3.4 Special UUIDs

RFC 9562 defines two special-case UUIDs:

  1. Nil UUID: 00000000-0000-0000-0000-000000000000. Used to indicate "no ID" or a null reference.
  2. Max UUID: ffffffff-ffff-ffff-ffff-ffffffffffff. Used as a sentinel value or upper bound in range queries.