What is a UUID?
A UUID (universally unique identifier) is a 128-bit value used to identify something without asking a central authority for a number. Because they are practically unique, any server, device or browser can create one and be confident nobody else has the same one. UUIDs are defined in RFC 9562, which replaced RFC 4122 in 2024.
They are written as 32 hexadecimal digits in five groups:
0192f1c4-3b7a-7cc1-9d2e-5f6a7b8c9d0e
^ ^
│ └ variant (8, 9, a or b for standard UUIDs)
└ version
The first digit of the third group is the version, which says how the UUID was made. The first digit of the fourth group encodes the variant, which for every modern UUID is the RFC 9562 layout.
How to generate UUIDs
- Choose Version 4 for random IDs or Version 7 for IDs that sort by creation time.
- Set how many you need, up to 1,000.
- Pick a format: lowercase or uppercase, with or without hyphens or braces, as lines, a JSON array or comma-separated.
- Select Copy all or Download. Generate new creates a fresh batch.
UUID versions
- Version 4 is 122 random bits plus the version and variant. It is the most widely used and reveals nothing about where or when it was made.
- Version 7 starts with a 48-bit Unix timestamp in milliseconds, followed by random bits. IDs created later sort later, which makes v7 a good primary key.
- Version 1 and version 6 are based on a timestamp and a node ID, historically the computer’s MAC address. Version 6 reorders version 1 so it sorts by time. Prefer v7 for new systems. This generator's v1 uses a random node ID, so it never reveals your hardware.
- Version 3 and version 5 are derived from a namespace and a name with MD5 or SHA-1, so the same input always gives the same UUID. This tool makes v5, the recommended one: pick a namespace (DNS, URL, OID or X.500) and enter a name.
- The nil UUID (all zeros) and max UUID (all
f) are special values, often used to mean "none" or "any".
A ULID is not a UUID but serves the same purpose: 26 characters (Crockford Base32) holding a 48-bit millisecond timestamp and 80 random bits, so ULIDs sort by creation time like v7.
Paste any UUID or ULID into Inspect a UUID to see its version, variant and, for versions 1, 6 and 7 and ULIDs, when it was created.
Version 4 or version 7 for database keys?
Random v4 keys are inserted at random positions in a database index, which splits index pages, wastes cache and slows writes on large tables. v7 keys are nearly sequential, so new rows go to the end of the index, much like an auto-increment integer, while still being safe to generate anywhere.
The trade-off is privacy: a v7 UUID reveals its creation time to the millisecond. If IDs are public and creation times are sensitive, use v4.
Generating UUIDs in code
// Browsers and Node.js: version 4
crypto.randomUUID();
import uuid
uuid.uuid4()
uuid.uuid7() # Python 3.14 and later
-- PostgreSQL
SELECT gen_random_uuid(); -- version 4
SELECT uuidv7(); -- version 7, PostgreSQL 18 and later
On the command line, uuidgen is available on macOS and most Linux systems.