Definition

The variant is a bit field within a UUID that identifies which layout specification the UUID conforms to. It tells parsing software which rules to apply when reading the UUID’s internal structure.

RFC 9562 defines the variant as occupying the two most significant bits of byte 8 (the first byte of the fourth group in the string representation). For standard RFC 9562 UUIDs, these two bits are always 10 (binary).

Where to find it

In the canonical UUID string format, the variant appears as the first character of the fourth group — position 17 when counting from 1:

550e8400-e29b-41d4-a716-446655440000
                   ^
                   position 17 — the variant digit

For any RFC 9562-compliant UUID, this character will always be one of: 8, 9, a, or b.

Why four possible values?

The variant field uses the top two bits of the byte, not the whole byte. Setting those two bits to 10 leaves 6 remaining bits free for other data — those 6 bits form part of the UUID’s payload (random data, timestamp bits, etc.).

The four hex digits that start with binary 10 are:

HexBinary
81000
91001
a1010
b1011

All four are valid for RFC 9562 UUIDs. The remaining two bits (00, 01, 10, 11) within those nibbles are part of the payload data, not the variant.

Variant values defined by RFC 9562

RFC 9562 defines three variant values:

Variant bitsMeaning
0xxxxxxxReserved — NCS backward compatibility (rare, legacy)
10xxxxxxRFC 9562 / RFC 4122 — the standard used everywhere today
110xxxxxReserved — Microsoft GUID backward compatibility
111xxxxxReserved — future use

The 10xxxxxx variant is what you will encounter in virtually all modern UUIDs. The NCS and Microsoft variants exist only in legacy systems predating the RFC.

Variant vs Version

These two fields are often confused:

FieldPositionTells you
VariantPosition 17 (first char of group 4)Which layout specification the UUID follows
VersionPosition 13 (first char of group 3)How the UUID was generated (random, time-based, etc.)

Example — identifying both fields at a glance:

550e8400-e29b-41d4-a716-446655440000
              ^    ^
              |    variant: 'a' → RFC 9562 (bits 10xxxxxx)
              version: '4' → randomly generated (UUID v4)

Practical use

In most application code, you never need to inspect or set the variant. UUID libraries handle it automatically. You may encounter it when:

Frequently asked questions

What is the UUID variant?

The variant is a 2-bit field in a UUID that identifies which layout specification the UUID follows. The standard RFC 9562 variant has the top two bits set to 10 (binary), producing the first digit 8, 9, a, or b in the fourth group of the UUID string.

Which UUID version should I use?

For database primary keys and event IDs, use v7 — its millisecond timestamp prefix keeps B-tree inserts sequential. For externally visible identifiers like URLs and tokens, use v4 — pure randomness with no timestamp leakage. v5 is the choice when you need a deterministic UUID derived from a name or URL.