What Is a UUID?
A UUID — Universally Unique Identifier — is a 128-bit value formatted as 32 hexadecimal characters separated by hyphens in a 8-4-4-4-12 pattern: 550e8400-e29b-41d4-a716-446655440000. Defined by RFC 4122 and its successor RFC 9562, UUIDs provide a way to generate unique identifiers without a central authority or coordination between distributed systems. You do not need to check a database, call an API, or increment a counter. You generate one locally and it is unique — not theoretically unique, but practically unique across all computers that have ever existed and ever will exist, given the astronomically low collision probability.
The term GUID — Globally Unique Identifier — is Microsoft's name for the same thing. GUIDs and UUIDs are identical in structure and behavior. Windows APIs use the GUID terminology while Linux, macOS, and most programming languages use UUID. The difference is purely naming. Under the hood, both are 128-bit values with the same formatting convention and the same version/variant fields. If someone asks you for a GUID, generate a UUID and you are done.
There are several UUID versions, each with different generation strategies. Version 1 combines the current timestamp with the MAC address of the generating machine — it is unique and time-ordered but leaks hardware identity. Version 4 is entirely random — 122 bits of randomness with 6 bits reserved for version and variant markers. This gives you 2^122 possible values, which is approximately 5.3 x 10^36. If you generated one billion UUIDs per second, it would take about 100 years before you had a 50% chance of a single collision. Version 5 produces deterministic UUIDs by hashing a namespace and a name with SHA-1 — the same inputs always produce the same UUID. Version 7, defined in the newer RFC 9562, embeds a Unix timestamp in the most significant bits so UUIDs sort chronologically while keeping the remaining bits random. This makes v7 ideal for database primary keys where index performance depends on insertion order.