Every time you need a universally unique identifier that carries its own creation time, a UUID v7 generator gives you a time-ordered, collision-resistant ID backed by cryptographic randomness. Whether you're assigning row keys in a distributed data store, tagging event IDs in a message queue, or populating test fixtures, understanding exactly what your output encodes helps you make better architecture decisions.
What Is a UUID v7?
A UUID is a 128-bit label represented as a 32-character hex string in five groups: xxxxxxxx-xxxx-7xxx-xxxx-xxxxxxxxxxxx. UUID v7 is the modern format defined in RFC 9562 — the IETF standard that supersedes the original RFC 4122. Unlike UUID v1 (which exposes a MAC-derived node identifier) or UUID v3 (name-based hashing), version 7 was engineered for high-throughput systems: timestamp-based ordering combined with strong unpredictability and no hardware data.
Field by field, a UUID v7 encodes:
- Bits 0–47 (48 bits): Unix time in milliseconds since the epoch (1970-01-01 UTC) — the first two hex groups
- Bits 48–51 (4 bits): the version marker, fixed at
0111binary (hex "7") - Bits 52–63 (12 bits): a random/sequence segment providing within-millisecond distinctness
- Bits 64–65 (2 bits): the variant field, fixed at
10per RFC 4122/9562 - Bits 66–127 (62 bits): cryptographically random data
Unix Timestamp and Millisecond Precision
Because the most-significant bits always reflect creation time, UUIDs generated with a uuid v7 generator sort lexicographically by their embedded timestamp — this tool automatically decodes and displays that Unix timestamp and creation date alongside each UUID it generates. An ID produced one millisecond later always sorts higher, giving you monotonic values that follow insertion order naturally.
Randomness and Entropy
After the fixed version and variant bits, the remaining 74 bits are filled with cryptographically secure random data — the same class of unpredictability used in cryptographic applications. Even two IDs produced within the same millisecond stay unique thanks to the differing random bits, and the collision probability across a distributed system generating millions of IDs per second remains negligible.
Why Choose UUID v7 Over UUID v4?
A UUID v4 is fully random in every bit position except the fixed version/variant bits — great for unpredictability, costly for database efficiency. When v4 values land in a B-tree index (as used by PostgreSQL, MySQL, and most relational engines), each new row inserts at a random position, forcing frequent page splits under high write volume. Use the uuid decoder to decode UUID v1 and v7 timestamps to human-readable dates and times.
A UUID v7 generator solves this by prepending the millisecond timestamp to the random bits. New IDs are mostly monotonic and cluster near the end of the index rather than scattering — giving you v4's global uniqueness with much better index locality, and none of v1's hardware-exposure cost.
Key Advantages for Database Primary Keys
- B-tree index efficiency — sequential inserts cluster together, reducing page splits under concurrent writes
- Chronological sequencing — sort by the ID alone, no separate
created_atcolumn required for ordering - Distributed-safe — every node generates globally unique, roughly monotonic IDs independently, no shared sequence needed
- Privacy-preserving — unlike UUID v1, no hardware or network address is embedded, only time and random data
When an Alternative May Fit Better
UUID v7 isn't always the right choice. Prefer plain UUID v4 when you explicitly want zero time exposure, such as session tokens. ULID offers similar time-sortability with a Crockford Base32, URL-safe encoding some teams prefer. Nano ID trades the UUID format for a shorter, configurable string when label length matters more than standardization. A plain auto-incrementing integer remains the most storage-efficient option for single-node systems that don't need distributed generation.
Bulk UUID v7 Generation
Generating many UUID v7 values at once is as simple as selecting your desired quantity and clicking generate — the tool runs locally in your browser, so nothing is transmitted externally. IDs created in rapid succession share the same 48-bit time prefix when produced within the same millisecond, but always differ in their random bits, so distinctness holds even across large batches.
A worked example for database seeding: to seed 100 UUID v7 row keys into a test table, select 100 from the quantity selector and generate — because each ID embeds its creation timestamp, the batch is already time-ordered, so your test data reflects realistic insertion order with no extra sorting step.
After producing a batch, you have two export options:
- Copy All — places the entire list on your clipboard, one UUID per line, ready to paste into scripts or SQL seed files
- Download — saves the batch as a text file for use in command-line scripts or automated tests
Frequently Asked Questions
What is a UUID Version 7?
UUID v7 is a time-ordered universally unique identifier, standardized in RFC 9562, that combines a 48-bit Unix millisecond timestamp with cryptographically random data. It sorts naturally by creation time while remaining globally unique.
Why use UUID v7 instead of UUID v4?
UUID v4 is fully random, so new database rows land at random positions in a B-tree index, causing page splits and fragmentation under high write volume. UUID v7's leading timestamp keeps new inserts roughly sequential, avoiding that penalty.
Why use UUID v7 instead of UUID v1?
UUID v1 embeds a MAC-derived node identifier, which can expose hardware information. UUID v7 carries only a timestamp and random data — no hardware address — while sorting more reliably than v1's split timestamp fields.
Is UUID v7 globally unique?
Yes. After the fixed version and variant bits, UUID v7 still has 74 bits of cryptographically random data, giving a collision probability that stays negligible even across many machines generating IDs independently and simultaneously.
Can I generate UUID v7 in bulk?
Yes — use the bulk generation option above to create up to 100 UUID v7 values at once, then copy them all or download as a text file.