How to decode a UUID
Embedded in every UUID is the version and variant of the UUID. Other information such as the time the UUID was generated can also be extracted in some cases. The tool above extracts this information automatically.
The UUID version is represented by the 13th digit of a hexadecimal UUID string ("M" in the diagram below). The variant is represented in the 17th digit ("N" in the diagram below).
The version is straight forward to decode. If digit M is 1 then the UUID is version-1, if M is 3 then the UUID is version-3, etc.
Version Digit ("M")
|Hex Digit||UUID Version|
|6 - f, 0||version unknown|
† RFC 4122 reserves version-2 for "DCE security" UUIDs however no details are provided. For this reason, we omit version-2 from our UUID generator.
The variant is slightly more complicated. To understand how the variant is encoding you must first understand how hexadecimals work.
UUIDs are written in hexadecimal which means each digit can be a number from 0 to 9 or a letter from a to f. That is 16 possibilities for each digit. So each hexadecimal digit represents 4 bits. There are 32 hex digits in a UUID times 4 bits gives a total of 128 bits in a UUID.
To determine the variant you look at the bits of the 17th hex digit in a UUID. For example, if the 4 binary digits begin "10" then the variant is "DCE 1.1, ISO/IEC 11578:1996". If the binary digits begin "110" then the UUID is a "Microsoft GUID". See the table below for full break down.
Only the number of leading "1"s matters. The bits after first 0 in the 17th hex digit are considered part of the "contents" of the UUID. "Contents" is a combination of time and machine identifier for version-1 UUIDS, for version-4 UUIDs contents is random, and for version-3 and version-5 the contents is a hash of the namespace and name.
Variant digit ("N")
|Binary Representation ‡||Hex Digit||Variant|
|0xxx||0 - 7||reserved (NCS backward compatible)|
|10xx||8 - b||DCE 1.1, ISO/IEC 11578:1996|
|110x||c - d||reserved (Microsoft GUID)|
|1110||e||reserved (future use)|
|1111||f||unknown / invalid. Must end with "0"|
‡ "x" in the binary representation indicates the bit is not significant for determining the variant.