UUID v7 Generator
Generate RFC 9562 UUID v7 identifiers โ time-ordered, 128-bit, ideal as database primary keys.
Last updated: April 2026 ยท Runs in your browser ยท No sign-up
- 019dbc2d-efac-79f3-85a7-5d2cbd9a816d
Why time-ordered IDs help databases
Primary keys with random values force B-tree indexes to write to random pages, fragmenting the index and trashing the cache. Sequential IDs (like an auto-increment integer) write to the end of the index, keeping inserts fast. UUID v7 gives you the global uniqueness of a UUID with the locality of a sequential key.
Format
018fbb4e-4f2e-7abc-8123-abcdef012345 โ the version digit is '7' (first digit of the third group), variant bits are '8'-'b' (first digit of the fourth group).
Frequently Asked Questions
What's new in UUID v7?
UUID v7 (RFC 9562, 2024) embeds a millisecond timestamp in the leading 48 bits, followed by random bits. Unlike v4, UUIDs generated later always sort after earlier ones โ much better for B-tree index locality.
Should I switch from UUID v4 to v7?
For database primary keys, yes โ random v4s cause index fragmentation and cache misses. For tokens, session IDs or anywhere timing shouldn't leak, stick with v4.
v7 or ULID โ which is better?
They carry the same information (timestamp + randomness). UUID v7 is the IETF standard and fits existing UUID-typed columns. ULID is shorter (26 chars, Base32). Pick v7 for interop, ULID for readability.
Does v7 leak creation time?
Yes โ the first 48 bits are a millisecond timestamp. Don't use v7 where creation time is sensitive (e.g. password reset tokens). Use v4 or a cryptographically random token there.