Bookmarks

UUID — universally unique identifier

A 128-bit value generated without any central registry that practically never collides, even when billions of values are created on different machines.

Also: GUID, globally unique identifier, UUID

checked 9 Nov

All terms

A UUID is one of the most common ways to give a record, event or file a unique name without a central registry: values can be generated on different machines at the same time and still not collide. The current standard is RFC 9562, which replaced RFC 4122 in May 2024.

How a value is structured

textCanonical UUID notation: five groups of 8-4-4-4-12 characters
550e8400-e29b-41d4-a716-446655440000

The notation has 36 characters: 32 hexadecimal digits and four hyphens; letter case does not matter. In binary form a UUID takes 16 bytes. The value marks its variant and version; the rest is time, random bits or a hash. The idea comes from the Apollo network and OSF’s DCE, from where UUIDs reached Microsoft Windows, where they are still called GUIDs.

Versions

VersionHow it is generatedWhere it is used
1current time and the network card’s MAC addresslegacy systems; reveals the host’s address
3 and 5a hash of a name: MD5 or SHA-1values that can be reproduced from the same name
4random bitsthe main choice in libraries and databases
6version 1 with fields reordered for sortingbusy databases where insertion order matters
7a Unix timestamp in the high bits plus random bitsprimary keys: values grow over time

In practice, version 4, a purely random value, is almost always used. Version 7 appeared in RFC 9562 and has caught on where a UUID serves as a primary key: values that increase over time fit a database index better.

How reliable is uniqueness

A collision is only theoretically possible: in version 4, 122 of the 128 bits are random, and by the birthday problem the chance of at least one collision reaches 50% only after about 2.7 quintillion values. At the 10 million generations per second per machine assumed in the standard, that takes thousands of years. So duplicates are not tracked, and uniqueness is treated as practical.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • JWTJSON Web Token

    A JWT is a signed token that carries user data itself; a UUID inside it merely identifies one thing.

  • hash function

    A hash is computed from data and changes with it; a UUID is not derived from content and only distinguishes objects.

In depth in the references

where the topic is covered in detail