What Is a UUID? How Universally Unique Identifiers Work

A UUID is a long string of letters and numbers designed so that two different systems can generate IDs independently, with almost no chance of ever producing the same one.

What a UUID looks like

A UUID is typically written as 32 hexadecimal characters split into five groups by hyphens, like 123e4567-e89b-12d3-a456-426614174000. It represents a 128-bit number, just formatted for readability.

No central registry required

Unlike a sequential ID from a single database, a UUID can be generated independently by any device or program without checking in with a central authority, which is why UUIDs are common in distributed systems where many machines create records at once.

Version 4: random UUIDs

The most commonly used version is version 4, which fills almost all of the 128 bits with random data (a handful of bits are reserved to mark the version and variant). Its uniqueness comes from the sheer size of the random number space, not from any structure.

Other UUID versions exist for other purposes

Version 1 incorporates the generating device's network identifier and a timestamp. Versions 3 and 5 generate a UUID deterministically from a name and a namespace using a hash, so the same input always produces the same UUID. Tools and libraries typically default to version 4 unless one of these specific properties is needed.

"GUID" is mostly a naming difference

GUID (Globally Unique Identifier) is a term for essentially the same concept and format as a UUID, popularized through Microsoft platforms, and the two terms are commonly used interchangeably in practice.

Why collisions are considered practically impossible

A version 4 UUID has roughly 122 random bits, giving an enormous number of possible values. The commonly cited illustration is that a system would need to generate billions of UUIDs per second, sustained for years, before the odds of a single accidental duplicate became meaningfully non-negligible — far beyond what any real application approaches.

UUIDs trade size for convenience

A UUID is much longer than a simple incrementing integer ID, which costs some storage space and index efficiency in a database. Most systems accept that tradeoff because it removes the need for coordination between services when assigning IDs.

Frequently Asked Questions

Are UUIDs safe to use as security tokens, like session IDs?

A properly generated random (version 4) UUID has enough entropy to resist guessing, but it was not specifically designed as a cryptographic secret, so many security-sensitive use cases still prefer identifiers generated by a dedicated cryptographically secure random function instead.

Can a UUID be reversed to find the data it identifies?

No, a random UUID carries no information about the record it labels — it is just a unique label. Any connection between a UUID and its underlying data exists only in whatever database or system stores that mapping.