terminology – What's the difference between UUID and GUID?

Question:

I often see these two abbreviations, and I wonder what are the differences between them?

Answer:

In short: there is no difference , they mean the same thing. Think of them as a 16-byte (128-bit) value that is meant to be unique. Microsoft calls them GUIDs, while everyone else calls them UUIDs.

Both the authors of the UUID specification and Microsoft itself currently consider them synonymous:

  • RFC 4122 specifies that UUIDs are "also known as GUIDs (Globally Unique IDentifier)";

  • in ITU-T Recommendation X.667, ISO / IEC 9834-8: 2004 International Standard : “UUIDs are also known as Globally Unique Identifiers (GUIDs), but this term is not used in this Recommendation”;

  • and even Microsoft states in its documentation: "The term universally unique identifier (UUID) is sometimes used in Windows protocol specifications as a synonym for GUID."

However, the truly correct answer depends on what exactly the question means by the term "UUID".

The first part depends on what the questioner thinks about when he says "UUID".

It is implicit in the Microsoft documentation that all UUIDs are valid GUIDs. However, it remains unclear: is any GUID a valid UUID? In other words, is the UUID just a subset of the GUID, or is it the same set?

In RFC 4122, we can find four different "variants" of the UUID. This happened due to the fact that such 16-byte identifiers were used even before the UUID specification appeared. We tried to combine these options in the specification. According to section 4.1.1, the options are:

  • Option 0 ( 0xxx ) – Reserved for compatibility with the legacy Apollo Network Computing System;

  • option 1 ( 10xx ) – the main one, which is described in RFC 4122 (has five sub-options, called "versions");

  • Option 2 ( 110x ) – Reserved for backward compatibility with Microsoft systems;

  • Option 3 ( 111x ) – Reserved for the future.

According to RFC 4122, all UUID variants are "real UUIDs", so all GUIDs are UUIDs as well. If you literally answer the question "what is the difference between UUID and GUID", then, according to the RFC, the answer is – there is no difference (but taking into account what is written below).

But not all GUIDs are Option 1 UUIDs (for example, Microsoft COM has GUIDs that are Option 2 UUIDs). If answering the question "is there a difference between the GUID and the UUID of option 1", then the answer would be yes – they may be different. Someone asking a question about UUID and GUID is probably not aware of the existence of options, and when they say "UUID", they implicitly mean only the UUID of option 1 (for example, they heard something about UUID with MAC address + time and about random UUIDs, which are both versions of option 1). In this case, the answer is yes, there is a difference .

So the answer depends on what the questioner means when he says "UUID". Does he mean option 1 UUIDs or any UUIDs at all?

The second part depends on which specification is used as the definition of the UUID.

Let's take a look at ITU-T X.667 ISO / IEC 9834-8: 2004 , which should be fully compliant with RFC 4122. There is an additional clause in 11.2 that says (translation): “All UUIDs conforming to this Recommendation | International Standard shall have variant bits with bit 7 of octet 7 set to 1 and bit 6 of octet 7 set to 0 ". Translated into human language, this means that only the UUID option 1 ( 10xx ) conforms to this standard. In this case, not all GUIDs match the ITU-T / ISO / IEC UUIDs.

So the real answer also depends on which UUID specification the question implies. If we're talking about any UUIDs, not just Option 1 UUIDs, it turns out like this: there is no difference between a GUID and an IETF UUID (RFC 4122), but there is a difference between a GUID and an ITU-T / ISO / IEC UUID!

Binary encoding may differ as well. When encoding a GUID, the byte order of the first three fields can be changed. This is in contrast to UUID, which always only uses network byte order (big endian). If you need to encode a UUID / GUID to binary, carefully read the documentation for your UUID / GUID implementation for byte ordering.

Биты  Байты  Название поля   Порядок байтов  Порядок байтов
                             (GUID)          RFC 4122

32    4      Data1           Native          Big
16    2      Data2           Native          Big
16    2      Data3           Native          Big
64    8      Data4           Big             Big

Slightly loose translation of a response from Hoylen on enSO with additions from the community. The numbering of UUID variants is undefined in the RFC, and in this answer the variants are numbered according to the number of non-zero bits in the variant designation (as in Wikipedia).

Scroll to Top