Version 7 UUID Generator

Unix millisecond timestamp + random. Time-sortable; ideal database key.

Decode
Options & format

Formatting is applied instantly in your browser. A GUID is a UUID: tick Uppercase + Braces for the Microsoft registry style.

API
http://uuidtools.com/api/generate/v7

Plain-text and JSON API docs: no key required.

About Version 7 UUIDs

A version 7 UUID begins with a 48-bit Unix timestamp in milliseconds followed by random bits. Because the timestamp comes first, v7 UUIDs sort in the order they were created, which keeps database indexes compact and fast.

RFC 9562 (May 2024) recommends v7 over v1 and v6 for new systems that need time-ordered identifiers. Within the same millisecond our generator keeps IDs strictly increasing.

Structure

unix_ts_ms (48 bits) | 7 | rand_a (12) | variant (2) + rand_b (62)

When to use it

  • Database primary keys (PostgreSQL, MySQL, SQL Server), especially on large tables.
  • Event, log, message and job IDs where chronological order is useful.

When to avoid it

  • Identifiers that must not leak their creation time: v7 reveals when it was made to the millisecond. Use v4.

Frequently asked questions

Is UUID v7 sortable?

Yes. The first 48 bits are a big-endian Unix millisecond timestamp, so comparing v7 UUIDs as strings or bytes sorts them by creation time.

Should I use UUID v7 or v4 for primary keys?

Use v7 when the database indexes the key: new rows are appended near the end of the index instead of landing in random places, which reduces page splits and cache misses. Use v4 when you do not want to expose creation time.