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
550e8400-e29b-41d4-a716-446655440000The 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
| Version | How it is generated | Where it is used |
|---|---|---|
| 1 | current time and the network card’s MAC address | legacy systems; reveals the host’s address |
| 3 and 5 | a hash of a name: MD5 or SHA-1 | values that can be reproduced from the same name |
| 4 | random bits | the main choice in libraries and databases |
| 6 | version 1 with fields reordered for sorting | busy databases where insertion order matters |
| 7 | a Unix timestamp in the high bits plus random bits | primary 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 pagesVerified 9 Nov