Local-only · RFC 9562 v7
UUID v7 Generator
Time-ordered, B-tree friendly UUIDs (RFC 9562) — a 48-bit Unix millisecond timestamp followed by 74 bits of Web Crypto randomness, monotonically sorted within each millisecond.
UUID v7
Anatomy of a v7 UUID
Your first generated value, annotated bit-by-bit per RFC 9562.
The leading 12 hex digits (48 bits) encode the big-endian Unix millisecond timestamp, followed by version 7, a 12-bit monotonic rand_a counter, RFC variant 8, 9, a or b, and 62 bits of rand_b entropy. Because the timestamp sits in the most significant bits, lexical sort order matches creation order.
UUID v7 Timestamp Decoder
Paste any UUID v7 to inspect its embedded UTC creation time and RFC 9562 version bits.
Use it in code
One block, pick your stack — live-synced to your first generated UUID v7.
-- PostgreSQL 18+ ships built-in uuidv7() and uuid_extract_timestamp()
CREATE TABLE events (
id UUID PRIMARY KEY DEFAULT uuidv7(),
payload JSONB NOT NULL
);
INSERT INTO events (id, payload)
VALUES ('', '{"event":"signup"}');
SELECT uuid_extract_timestamp(''::uuid);// npm install uuid (v11+ supports RFC 9562 v7)
import { v7 as uuidv7 } from 'uuid';
const id = uuidv7();
// → ''
// Extract 48-bit Unix ms timestamp
const ms = parseInt(id.replace(/-/g, '').slice(0, 12), 16);
console.log(new Date(ms).toISOString());# Python 3.14+ adds uuid.uuid7(); on 3.8–3.13 use `pip install uuid6` from uuid6 import uuid7 event_id = uuid7() # → print(event_id.time) # Unix timestamp in milliseconds
// go get github.com/google/uuid
package main
import (
"fmt"
"github.com/google/uuid"
)
func main() {
id, _ := uuid.NewV7()
fmt.Println(id.String())
// →
}UUID v7 vs UUID v4 vs ULID
Pick the identifier format that matches your database and API requirements.
UUID column (16 bytes), chronological B-tree localityReveals millisecond creation time; 74 random bits vs v4's 122UUID type without binary conversion