Mint 1–100 CSPRNG-backed UUID v4, RFC 9562 time-ordered UUID v7, Crockford Base32 ULIDs, or compact URL-safe NanoIDs in one click, and decode the exact millisecond creation timestamp embedded inside any UUID v7 or ULID.
Random UUID v4 primary keys eliminate coordination across distributed microservices, but inserting random 128-bit values into PostgreSQL or MySQL B-tree indexes fragments leaf pages and spikes write amplification under high throughput.
RFC 9562 UUID v7 and ULID solve B-tree locality by prefixing 48 bits of Unix millisecond timestamp ahead of cryptographically random bits. Every identifier minted here draws entropy exclusively from window.crypto.getRandomValues—never Math.random().
Distributed ID Design Pitfalls
01. Using Math.random() for Identifier Entropy
Math.random() is a non-cryptographic PRNG with narrow internal state and predictable sequences. Production tokens and primary keys must use Web Crypto CSPRNG (crypto.getRandomValues).
02. Exposing Creation Timestamps in Sensitive Public URLs
Because UUID v7 and ULID encode millisecond timestamps in their leading characters, competitors can estimate record creation dates or ingestion rates from public URLs. Use UUID v4 or NanoID for opaque public share links.
03. Confusing Crockford Base32 With Standard Base32
ULIDs intentionally exclude I, L, O, and U to avoid visual ambiguity when humans read IDs aloud. Standard RFC 4648 Base32 decoders will misinterpret ULID timestamps.
Modern Distributed Identifier Comparison
| Format | Length & Bit Layout | Primary Advantage |
|---|---|---|
| UUID v4 | 36 chars · 122 random bits + version/variant | Maximum opacity, universal SQL uuid column support |
| UUID v7 | 36 chars · 48-bit Unix ms + 74 random bits | Monotonic B-tree inserts with native Postgres uuid type |
| ULID | 26 chars · 48-bit ms + 80 random (Base32) | Shorter, case-insensitive, lexicographically sortable |
| NanoID | 21 chars default · URL-safe [A-Za-z0-9_-] | Compact URL slugs with collision resistance ≈ UUID v4 |
Worked Engineering Examples
Inspecting a UUID v7 Timestamp
0193f8a2-7c00-7a4b-9e12-4c9a12b7e810
Format: UUID v7 · 48-bit prefix 0x0193f8a27c00 -> 2024-12-24T12:26:58.432Z
Extracting the first 12 hex digits recovers exact millisecond creation time without querying a created_at column.
Choosing NanoID Length for Short Links
Kind: NanoID, Length: 21, Count: 10
10 URL-safe 21-char IDs (~126 bits of entropy)
21 characters from a 64-symbol alphabet deliver slightly more entropy than UUID v4 while saving 15 characters per URL.
Frequently Asked Questions
Why is UUID v7 replacing UUID v4 in PostgreSQL 17/18 and modern backends?
UUID v7 retains the exact 16-byte binary uuid column format while sorting chronologically by leading timestamp bits, dramatically reducing B-tree page splits and WAL bloat.
Are generated identifiers guaranteed to use cryptographic randomness?
Yes. Every random byte comes from the browser native Web Crypto API (crypto.getRandomValues), sourced from the OS CSPRNG.
Can I extract the timestamp from a UUID v4?
No. UUID v4 contains no time component—all 122 payload bits are purely random. Only time-ordered formats like UUID v7 and ULID carry embedded millisecond timestamps.
How many IDs can I generate at once?
You can generate batches from 1 up to 100 identifiers per run, toggle uppercase formatting, copy the entire newline-separated batch, or download as a .txt file.