Advertisement

UUID v7 Generator

Generate modern time-ordered UUIDs (version 7) in your browser. v7 stores a Unix millisecond timestamp in the leading bits, so IDs sort chronologically as plain strings and keep database indexes compact and fast.

UUID v7 options

Time-ordered IDs with a Unix millisecond timestamp.

Press Generate UUIDs.

Everything runs locally. Nothing is sent to any server.

Advertisement

How UUID v7 works

Version 7 puts a 48-bit Unix timestamp in milliseconds in the most significant bits, followed by the version nibble 7, 12 random bits, the RFC 4122 variant bits, and 62 more random bits. Because time leads, v7 IDs sort chronologically as plain strings, and the 74 random bits keep IDs unique even when thousands are minted in the same millisecond.

Why v7 beats v1 and v4 for databases

Random v4 IDs scatter writes across a B-tree index, causing page splits and slow inserts. v7 IDs arrive in monotonic order, so new rows append at the end of the index, which is dramatically faster at scale. Unlike v1, v7 reveals only millisecond precision and uses no MAC address, so it leaks far less information.

UUID v7 Generator FAQs

Are UUID v7 values sortable by creation time?
Yes. The leading 48 bits are the Unix millisecond timestamp, so sorting v7 strings lexicographically is the same as sorting by creation time, down to millisecond precision.
Should I use v7 as a database primary key?
It is an excellent choice. Monotonic inserts keep B-tree indexes compact and fast, unlike random v4 keys which fragment the index. PostgreSQL, MySQL and MongoDB users widely adopt v7 for this reason.
How is v7 different from v1?
Both are time-ordered, but v7 uses the Unix epoch in milliseconds (simpler and monotonic), carries 74 random bits instead of a MAC-based node, and is designed for modern database index locality.
Can two v7 UUIDs collide?
Only if 74 random bits collide within the same millisecond, which has about 1 in 19 quintillion odds per pair. For any realistic workload, collisions never happen.
Does v7 leak the exact generation time?
It exposes millisecond precision, which is usually harmless. If even that is a concern (for example in security tokens), use v4, which carries no time information at all.
Advertisement