What makes a UUID version 7
Version 7 was standardized in RFC 9562 in 2024. Its first 48 bits are a Unix timestamp in milliseconds, followed by the version digit 7, more random bits, the variant, and a final block of random bits. Because the timestamp comes first, a UUID generated later always sorts after one generated earlier, whether you compare the raw bytes or the lowercase text.
The remaining random bits keep version 7 values unique across machines and processes, even when many IDs are created in the same millisecond. You can recognize a version 7 UUID by the digit 7 at the start of its third group.
Why databases prefer version 7
Relational databases store primary keys in B-tree indexes. Random keys are inserted all over the index, which forces the database to load scattered pages, split full pages, and leave fragmentation behind. Time-ordered version 7 keys are appended near the end of the index instead, so the same pages stay in memory and inserts behave much like an auto-increment integer.
You keep the advantages of UUIDs at the same time: IDs can be generated by any service or client without a central sequence, merged across databases without conflicts, and created before a row is ever written. That combination is why version 7 has quickly become the recommended choice for new primary keys.
Reading the timestamp, and the privacy trade-off
The first twelve hexadecimal digits of a version 7 UUID are its creation time. Converting them from hexadecimal gives milliseconds since 1970, which is useful for debugging and for rough time-based sorting without an extra column.
The same property means anyone who sees the ID can tell when the record was created. For internal keys that is rarely a concern, but for public URLs such as account or order pages you may prefer to expose a version 4 UUID and keep the version 7 key private.
Generating version 7 in code
Support is growing quickly: PostgreSQL 18 includes uuidv7(), Python 3.14 adds uuid.uuid7(), .NET 9 offers Guid.CreateVersion7(), and the popular uuid package provides v7() for JavaScript. For scripts, https://utilistudio.com/api/uuid?version=7 returns a fresh value as plain text.