What a UUID is
A UUID (universally unique identifier) is a 128-bit number, written as 32 hexadecimal digits in five groups: 919108f7-52d1-4320-9bac-f847db4148a8. Anyone can create one on any device, with no central counter, and still be confident nobody else will ever create the same value. That is why UUIDs label database rows, files, orders, devices and API requests.
The current standard is RFC 9562 (published in 2024), which replaced the older RFC 4122. Two small parts of every standard UUID are fixed:
- The version digit is the first digit of the third group. In
4320it is 4. - The variant digit is the first digit of the fourth group. For standard UUIDs it is 8, 9, a or b, as in
9bac.
Everything else is either random or, for time-based versions, a timestamp.
Version 4 or version 7?
This generator makes the two versions most people need:
| Version 4 | Version 7 | |
|---|---|---|
| First 48 bits | Random | Unix time in milliseconds |
| Random bits | 122 | 74 (random, or a counter within the same millisecond) |
| Sorts by creation time | No | Yes |
| Reveals when it was made | No | Yes, to the millisecond |
| Best for | General IDs, test data, file names | Database keys, logs, events |
Version 4 is the safe default. It is almost entirely random, so it reveals nothing about when or where it was made.
Version 7 puts the time first. New IDs sort after older ones, so a database index grows at one end instead of being scattered at random. That keeps inserts fast on large tables, which is why v7 is now the usual choice for primary keys. The generator follows the standard’s advice to keep v7 IDs in order even when many are made in the same millisecond, so a bulk batch is already sorted.
Worked example: the time inside a v7 UUID
Take the example from RFC 9562: 017f22e2-79b0-7cc3-98c4-dc0c0c07398f.
- The first 12 hex digits,
017f22e279b0, are the timestamp. In decimal that is 1,645,557,742,000 milliseconds after 1 January 1970. - That moment is 22 February 2022, 19:22:22 UTC.
- The
7that starts the third group is the version, and the9that starts the fourth group marks a standard UUID.
Paste it into Check a UUID above and the tool shows the same date. It also reads the time inside version 1 and version 6 UUIDs, which count in 100-nanosecond steps from 15 October 1582, the start of the Gregorian calendar.
How unlikely is a duplicate?
For version 4, duplicates follow the “birthday problem”. With n random UUIDs, the chance that any two match is roughly:
Generate one billion v4 UUIDs and p is about 0.00000000000000000009. You would need around 2.7 quintillion (2.7 × 10¹⁸) before a single duplicate became a coin flip. In practice the real risk is not the maths but a weak random number generator. This tool uses your browser’s cryptographic generator, the same one used for encryption keys.
Formats you will meet
All of these are the same 128-bit value, just written differently:
| Format | Example | Where you see it |
|---|---|---|
| Standard | 919108f7-52d1-4320-9bac-f847db4148a8 |
Most APIs and databases |
| Uppercase in braces | {919108F7-52D1-4320-9BAC-F847DB4148A8} |
Windows, .NET and the registry, where it is called a GUID |
| No hyphens | 919108f752d143209bacf847db4148a8 |
Compact storage and file names |
| URN | urn:uuid:919108f7-52d1-4320-9bac-f847db4148a8 |
XML and some standards |
The standard says to write UUIDs in lowercase but to accept uppercase, so comparisons should ignore case. The checker accepts every form above, plus quotes and trailing commas copied from code.
Two special values exist. The Nil UUID is all zeros and usually means “no value”. The Max UUID is all f digits and was added in RFC 9562 as a sentinel.
Tips
- Store UUIDs as UUIDs. Databases such as PostgreSQL have a native
uuidtype that uses 16 bytes. Storing the 36-character text form takes more than twice the space and makes indexes slower. - Use the list formats for code. Quoted, comma-separated output drops straight into a JSON array, a JavaScript array or an SQL
IN (…)list. Tidy the result with the JSON formatter. - Don’t treat a UUID as a secret. IDs tend to appear in URLs and logs, and a v7 UUID reveals its creation time. For passwords and API keys use the password generator.
- Need a fingerprint, not an ID? A UUID is random; a hash is calculated from data. To check that a file hasn’t changed, use the hash generator.
Every UUID here is generated in your browser. Nothing is sent to a server or stored, so you can use them freely in private projects.