Sortable UUID v7 generator
A UUID v7 is the newest standard UUID version, defined by RFC 9562, and is designed to be time-sortable. It leads with a 48-bit Unix millisecond timestamp and fills the rest with cryptographic randomness, so a sequence of v7 UUIDs sorts in creation order while keeping the global uniqueness of a UUID. This combination — the ordering of an auto-increment key with the decentralised uniqueness of a UUID — makes v7 the modern default for database primary keys. This tool generates one ID or a sortable batch, all in your browser.
How it works
The 128 bits are arranged so that time comes first:
| Bits | Field | Content |
|---|---|---|
| 48 | Timestamp | Unix time in milliseconds |
| 4 | Version | Fixed: 7 |
| 12 | Random | From Web Crypto |
| 2 | Variant | RFC 4122 |
| 62 | Random | From Web Crypto |
Because the timestamp occupies the most significant bits, comparing two v7 UUIDs
as strings or bytes orders them by creation time. The random portion (74 bits)
comes from crypto.getRandomValues, keeping each value unique. When generating a
batch, the timestamp is advanced per ID so the batch stays strictly increasing.
Example
A v7 UUID looks like 018f3a2b-1c4d-7e8a-9b0c-1d2e3f4a5b6c. The leading
018f3a2b-1c4d is the millisecond timestamp, the 7 at the start of the third
group marks version 7, and the remaining hex is random. Generate three in a row and
their leading characters increase, so they sort in creation order out of the box.
Inserts stay roughly sequential, so indexes don’t fragment the way random v4 keys cause them to. The timestamp and random bits are generated in your browser with Web Crypto, and nothing is uploaded.