Why teams are migrating primary keys from UUID v4 to UUID v7
For years, backend engineers faced an awkward trade-off when designing SQL tables. Auto-incrementing 64-bit integers (BIGSERIAL / BIGINT) insert sequentially into B-tree indexes with minimal disk I/O, yet they break down the moment you generate IDs on mobile clients, shard databases, or merge rows across regions. UUID v4 solved global uniqueness, yet its 122 completely random bits scatter inserts across every page of a clustered index. On tables past a few million rows in PostgreSQL or MySQL InnoDB, that random scatter causes heavy B-tree page splits, bloated indexes, and slower buffer-pool hit rates.
Standardized by the IETF in RFC 9562 (May 2024), UUID v7 fixes that indexing penalty without giving up the 128-bit uuid column type. The first 48 bits store a big-endian Unix timestamp in milliseconds, followed by the 4-bit version nibble (7), 12 bits of monotonic sequence data, the 2-bit RFC variant, and 62 bits of CSPRNG entropy from crypto.getRandomValues(). New IDs sort lexicographically in chronological order, so database inserts land on the newest leaf page.
Monotonic ordering inside the same millisecond
When you click Generate Batch above and create 100 UUID v7 values in under a millisecond, all 100 IDs share the same 48-bit timestamp prefix. If the remaining bits were purely random, ID #42 could sort ahead of ID #41. This generator uses a 12-bit monotonic counter inside the rand_a field (incrementing by 1 for each ID emitted within the same millisecond, and rolling the timestamp forward if all 4,096 slots in one millisecond fill up). You can verify this by scanning the third group (7xxx) down the batch list: each line climbs cleanly in order.
Inspecting the embedded timestamp in production logs
One nice side effect of UUID v7 is instant debugging. Paste any UUID v7 from a support ticket, error log, or webhook payload into the Decode Timestamp box at the bottom of the workspace. The decoder extracts the first 12 hex characters (48 bits), converts them from hexadecimal to milliseconds since January 1, 1970, and prints the ISO 8601 UTC string, local time, and raw Unix epoch milliseconds. It also checks bit positions to confirm whether the string is actually version 7.
When to keep UUID v4 or switch to random tokens
Because anyone can decode that creation timestamp, UUID v7 reveals the exact millisecond a user account, invoice, or order row was created. If you do not want competitors estimating your signup velocity from public URLs, keep UUID v7 as the internal clustered primary key and expose a random UUID v4 externally. And never treat a UUID v7 as a secret API key or password-reset token: use our Random Token Generator for 256-bit bearer secrets.