uuid v7 · time-ordered · rfc 9562 · local

Generate time-ordered UUID v7s

RFC 9562 UUID v7 values — millisecond timestamp in the top bits, random in the rest. Perfect for database primary keys that sort by insert time.

UUID v7 Generator
Count
0
5 requested
Version
v7
time-ordered
Output
0 B
36 chars each
Status
—
rfc 9562
Count:
input · controls
Custom count

UUID v7 encodes a 48-bit millisecond Unix timestamp in the high-order bits, followed by 74 bits of randomness and a 4-bit version + 2-bit variant.

Values minted within the same millisecond differ only in the random part — still monotonically increasing across milliseconds.

output · uuid v7 (0)

Click Generate to mint UUID v7 values

Quick Start

How to generate UUID v7s

UUID v7 was standardised in RFC 9562 (May 2024). It pairs a millisecond timestamp with random bits to give you sortable, collision-resistant identifiers.

  1. 01

    Pick a count

    Pick a preset (1, 5, 10, 25, 100) or type any value up to 1000. The generator runs synchronously — even 1000 IDs mint in single-digit milliseconds because Web Crypto is fast.

    Each ID is independently sampled, so duplicates are statistically impossible — a v7 carries 74 bits of entropy plus the millisecond timestamp.

    RFC 9562preset1–1000synchronous
    input · countpreset · 5
    count: 5
    range: 1..1000
    5 requestedready
  2. 02

    Generate

    Each call reads the wall clock once (Date.now()), then pulls 10 random bytes from Web Crypto (crypto.getRandomValues). The result is a 128-bit value formatted as the canonical 36-character hyphenated UUID string.

    Bits 48–51 are fixed to 0111 (version 7) and bits 64–65 to 10 (RFC variant) — guaranteeing every output parses as a valid RFC 9562 UUID v7.

    RFC 9562crypto.getRandomValues128-bitv7 variant
    output · uuid v7k-sortable
    018f2d4a-1cf2-7a8e-b3d1-5e9c8a4d2f10
    36 charsmonotonic
  3. 03

    Check the order

    The first 12 hex characters are the 48-bit Unix millisecond timestamp. Because the timestamp lives in the high-order bits, lexical sort order matches creation order — IDs are time-ordered and k-sortable.

    This is the whole point: B-tree indexes stay tight, range queries by ID approximate range queries by time, and event streams self-order without a separate sequence column.

    time-orderedk-sortableB-treemonotonic
    prefix · ms timestamp48 bits
    018f2d4a1cf2 → 2024-05-23
    ts → lex → sort
    sortableRFC § 5.7
  4. 04

    Copy or download

    Copy the whole list to the clipboard or download as .txt for piping into a migration, seed file, or fixture. The format is one UUID per line — friendly for awk, jq, or a quick SQL VALUES block.

    Everything runs locally — Web Crypto is a browser primitive, so no IDs leave the page.

    clipboard.txtmigrationseed file
    export · uuid listready
    ✓ Copied 5 UUIDs
    ✓ Saved: uuid-v7.txt
    ✓ 100% client-side
    ready to shipsuccess
Pro tips

Encoding without surprises

Always UTF-8 first

Use TextEncoder / TextDecoder for bytes ↔ string conversion. btoa alone breaks on non-ASCII.

URL-safe vs standard Base64

Standard uses +, /, =; URL-safe swaps to -, _, no padding. Don’t mix them.

Hashes aren’t passwords

SHA-256 is fast; that’s good for fingerprints, bad for passwords. Use bcrypt / argon2 for credentials.

Watch padding rules

Some decoders are strict about = padding, others auto-pad. If round-trips fail at exactly 1 or 2 bytes, check padding.

Use Web Crypto for keys

Generate cryptographic keys via crypto.subtle, never Math.random. The latter is predictable.

JWT decode ≠ verify

Decoding a JWT just splits and base64-decodes. Verification needs the issuer’s public key / shared secret.

Use Cases

When to use UUID v7

Database keys, event IDs, sortable correlation IDs.

Database primary keys

Avoid B-tree index fragmentation that random v4 UUIDs cause. Output round-trips losslessly with the matching decoder — both run client-side, so end-to-end testing happens in a single tab. Encoding flows through TextEncoder for predictable UTF-8 semantics.

RFC-compliant

Event sourcing

Naturally sortable event IDs. Web Crypto's subtle.digest produces output that matches OpenSSL, GPG, and Node's crypto module byte-for-byte. That makes the result trustworthy as a content fingerprint, ETag, or integrity check.

OpenSSL-matched

Time-bucketed logs

Range queries by ID work like range queries by time. Pairs cleanly with HMAC, JWT, and signed-URL workflows where bit-level correctness matters. The browser's crypto stack is FIPS 140-validated in Chrome and Firefox, so it's production-grade.

lossless

Pagination

Stable, time-ordered cursors. Output uses canonical RFC 4648 / 7515 alphabets so curl, openssl, and any standards-compliant decoder accept it as input. URL-safe variants drop padding for tokens that travel in query strings.

byte-identical

Audit trails

Lexical order of IDs matches creation order. Heavy hashing runs through useMemo so large inputs don't block typing. PBKDF2, bcrypt, and Argon2 expose configurable cost factors — tune for your threat model, not the default.

spec-grade

Distributed inserts

Multiple nodes can mint IDs without coordination. Same input plus same options always yields identical bytes. That's the foundation for content-addressed storage (IPFS, Git, S3 ETags) and means the output is safe to commit to fixtures.

production-ready
FAQ

Frequently asked questions

UUID v7 encodes a timestamp, making it naturally sortable by creation time. This is critical for database performance: random UUIDs (v4) cause B-tree index fragmentation; v7 inserts at the end.
Yes. UUID v7 was standardised in RFC 9562 (May 2024), replacing the earlier draft.
Yes — the timestamp is recoverable from the ID. Don't use v7 where the creation time should be secret.
Both are time-ordered random IDs. ULID uses base32 (26 chars); UUID v7 uses standard UUID format (36 chars) so it drops into existing UUID columns.
No. UUID v7 is generated locally using Web Crypto. Nothing leaves your browser — it runs locally.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!