JustGenerator
Generators 100% Client-Side Privacy

UUID v7 Generator & Timestamp Decoder

Create monotonic RFC 9562 Version 7 UUIDs with a 48-bit Unix millisecond prefix for database primary keys, and inspect the exact timestamp inside any UUID v7.

Fresh Monotonic UUID v7

Loading...

10 UUIDs · RFC 9562 v7

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.

Common questions

What is the bit layout of a UUID v7 under RFC 9562?

A Version 7 UUID packs 128 bits into five hyphenated hex groups: 48 bits for the Unix epoch timestamp in milliseconds, 4 bits fixed to 0111 (version 7), 12 bits of monotonic sub-millisecond or random data, 2 bits fixed to 10 (RFC variant), and 62 bits of cryptographically random entropy.

How does UUID v7 differ from UUID v4 for database primary keys?

UUID v4 is completely random, so new rows land at scattered locations across a PostgreSQL or MySQL InnoDB B-tree index, triggering frequent page splits and cache misses. UUID v7 starts with a millisecond timestamp, so inserts append cleanly to the right edge of the B-tree like an auto-incrementing integer while staying globally unique.

Does UUID v7 leak when a record was created?

Yes. Because the first 12 hexadecimal characters encode the exact Unix millisecond timestamp, anyone who sees a UUID v7 in a URL or API response can decode the creation date down to the millisecond. If creation timing is sensitive, keep UUID v7 as an internal primary key and expose a random public ID or UUID v4.

What is monotonicity in UUID v7?

When your application generates multiple UUID v7 values within the exact same millisecond, pure random bits in the lower 74 bits could sort out of order. Monotonic generators increment a counter inside the 12-bit rand_a field (or advance the millisecond tick) so every generated ID sorts strictly after the previous one.

How does UUID v7 compare to ULID?

Both embed a 48-bit millisecond timestamp followed by random bits inside 128 bits. ULID renders as a 26-character Crockford Base32 string, whereas UUID v7 uses standard 36-character hex notation defined in IETF RFC 9562 and works natively inside SQL uuid columns, including PostgreSQL 18 uuidv7().

Can I use UUID v7 as a secret token or session key?

No. Over a third of a UUID v7 (48 of 128 bits) is a predictable public timestamp, and when the 12-bit rand_a field is used as a monotonic counter, only 62 random bits remain. For bearer tokens, session cookies, or password reset links, generate at least 256 random bits using a dedicated CSPRNG token generator.