Format

The following table gives the format of a UUID. The UUID consists of a record of 16 octets. The fields are in order of significance for comparison purposes, with "time_low" the most significant, and "node" the least significant.

Field Data Type Octet # Note
time_low unsigned 32 bit integer 0-3 The low field of the timestamp.
time_mid unsigned 16 bit integer 4-5 The middle field of the timestamp.
time_hi_and_version unsigned 16 bit integer 6-7 The high field of the timestamp multiplexed with the version number.
clock_seq_hi_and_reserved unsigned 8 bit integer 8 The high field of the clock sequence multiplexed with the variant.
clock_seq_low unsigned 8 bit integer 9 The low field of the clock sequence.
node unsigned 48 bit integer 10-15 The spatially unique node identifier.

To minimize confusion about bit assignments within octets, the UUID record definition is defined only in terms of fields that are integral numbers of octets. The version number is in the most significant 4 bits of the time stamp (time_hi), and the variant field is in the most significant 3 bits of the clock sequence (clock_seq_high).

The timestamp is a 60 bit value. For UUID version 1, this is represented by Coordinated Universal Time (UTC) as a count of 100-nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar).

The following table lists currently defined versions of the UUID.

Msb0 Msb1 Msb2 Msb3 Version Description
0 0 0 1 1 The version specified in this document.
0 0 1 0 2 Reserved for DCE Security version, with embedded POSIX UIDs.

The variant field determines the layout of the UUID. The structure of UUIDs is fixed across different versions within a variant, but not across variants; hence, other UUID variants may not interoperate with the UUID variant specified in this document. Interoperability of UUIDs is defined as the applicability of operations such as string conversion, comparison, and lexical ordering across different systems. The variant field consists of a variable number of the msbs of the clock_seq_hi_and_reserved field.

The following table lists the contents of the variant field.

Msb0 Msb1 Msb2 Description
0 - - Reserved, NCS backward compatibility.
1 0 - The variant specified in this document.
1 1 0 Reserved, Microsoft Corporation GUID.
1 1 1 Reserved for future definition.

The clock sequence is required to detect potential losses of monotonicity of the clock. Thus, this value marks discontinuities and prevents duplicates. An algorithm for generating this value is outlined in the “Clock Sequence” section below.

The clock sequence is encoded in the 6 least significant bits of the clock_seq_hi_and_reserved field and in the clock_seq_low field.

The node field consists of the IEEE address, usually the host address. For systems with multiple IEEE 802 nodes, any available node address can be used. The lowest addressed octet (octet number 10) contains the global/local bit and the unicast/multicast bit, and is the first octet of the address transmitted on an 802.3 LAN.

Depending on the network data representation, the multi-octet unsigned integer fields are subject to byte swapping when communicated between different endian machines.

The nil UUID is special form of UUID that is specified to have all 128 bits set to 0 (zero).