UUID v7 generator

Generate version 7 UUIDs, unique identifiers that embed a timestamp and so sort naturally in chronological order — handy as a database primary key. The calculation relies on your browser's cryptographic API, and nothing is sent to a server.

Results

How it works

Unlike UUID v4, which is entirely random, UUID v7 puts a Unix millisecond timestamp in the first 48 bits of the identifier, followed by 74 cryptographically secure random bits. The result: two UUID v7s generated a few seconds apart stay close together in lexicographic order, which improves insertion performance in a database index (B-tree) compared to a fully scattered UUID v4.

Why prefer UUID v7 over UUID v4 as a primary key?

A random UUID v4 causes heavy fragmentation of B-tree indexes during bulk inserts, because each new identifier lands in an unpredictable spot in the tree. UUID v7, on the other hand, increases over time like a classic auto-incremented ID, while keeping the advantage of being generated on the client side with no coordination with the database.

Can you recover the exact creation date from a UUID v7?

You can extract the millisecond timestamp encoded in the first 48 bits, and so get the approximate date and time (to the millisecond) the identifier was generated. If that information is sensitive in your context, prefer a classic UUID v4, which reveals no time data.

100% local processing: each identifier is calculated in your browser via crypto.getRandomValues, with no network request at all.