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 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.
Click Generate to mint UUID v7 values
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.
- 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–1000synchronousinput · countpreset · 5count: 5 range: 1..1000
5 requestedready - 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 to10(RFC variant) — guaranteeing every output parses as a valid RFC 9562 UUID v7.RFC 9562crypto.getRandomValues128-bitv7 variantoutput · uuid v7k-sortable018f2d4a-1cf2-7a8e-b3d1-5e9c8a4d2f10
36 charsmonotonic - 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-treemonotonicprefix · ms timestamp48 bits018f2d4a1cf2 → 2024-05-23 ts → lex → sort
sortableRFC § 5.7 - 04
Copy or download
Copy the whole list to the clipboard or download as
.txtfor piping into a migration, seed file, or fixture. The format is one UUID per line — friendly forawk,jq, or a quick SQLVALUESblock.Everything runs locally — Web Crypto is a browser primitive, so no IDs leave the page.
clipboard.txtmigrationseed fileexport · uuid listready✓ Copied 5 UUIDs ✓ Saved: uuid-v7.txt ✓ 100% client-side
ready to shipsuccess
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.
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-compliantEvent 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-matchedTime-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.
losslessPagination
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-identicalAudit 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-gradeDistributed 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-readyFrequently asked questions
Something missing?
Tell us what you need. We ship the top requests every two weeks.