What is a universally unique identifier (UUID)?
A UUID is 128 bits, written as 32 hexadecimal digits in five groups (8-4-4-4-12). Capital or small letters mean the same UUID. Two digits are fixed by the standard: the 13th is the version, which says how the UUID was made, and the 17th is always 8, 9, a or b, the variant. Everything else carries the UUID’s content. Here is how your first UUID breaks down:
Here it is with your numbers:
- Random bits = 128 − 4 version bits − 2 variant bits
- Random bits = 122
- Version digit (13th) = 4
- Variant digit (17th) = 9
It means two version 4 UUIDs match with a chance of 1 in 2¹²², which is 1 in 5,316,911,983,139,663,491,615,228,241,121,378,304.
Source IETF · RFC 9562, Universally Unique IDentifiers (UUIDs) (2024) ↗
Version 4 or version 7?
| Version | Made from | Use it when |
|---|---|---|
| Version 4 | 122 random bits | you just need a unique label; the standard also prefers it wherever security is involved |
| Version 7 | the time in milliseconds, then 74 random bits | you want new IDs to sort in the order they were made, such as database keys |
The standard recommends version 7 over the older time-based versions 1 and 6, which could include the computer’s network (MAC) address. This page makes every random bit with your browser’s cryptographic random generator; nothing is sent anywhere.
Source W3C · Web Cryptography Level 2, the Crypto interface ↗
FAQs
What is UUID and why is it used?
A UUID is a 128-bit identifier defined by the IETF’s RFC 9562. No central authority is needed to hand them out, so any computer can make one on the spot, and they are small and fixed in size, which suits databases, files and messages.
Source IETF · RFC 9562, Universally Unique IDentifiers (UUIDs) (2024) ↗
How can I create a UUID?
Use the generator above, or your programming language’s UUID library. A version 4 UUID is 128 random bits with 6 of them set to mark the version (4) and the variant; the standard says to take the random bits from a cryptographically secure generator, as this page does.
What can someone do with an UUID?
Usually nothing: it is just a label. But UUIDs aren’t secrets. The standard says not to assume they are hard to guess, and never to use one as the only thing that grants access to something.
Sources
- IETF: RFC 9562, Universally Unique IDentifiers (UUIDs) (2024)
- W3C: Web Cryptography Level 2, the Crypto interface