UUID & ID Generator
Generate UUID v4, UUID v7, nanoid, ULID, CUID, and short slugs in your browser. Cryptographically secure (crypto.getRandomValues), download as JSON / CSV / TXT, up to 10,000 per batch.
128-bit random identifier. The default for most databases. Not sortable.
e.g. 550e8400-e29b-41d4-a716-446655440000
Max 10,000 per batch.
Output
Click Generate to create IDs. Each one is produced with crypto.getRandomValues — cryptographically secure, never leaves your browser.
Which ID should you actually use?
For most new applications: UUID v7 is the right default in 2025. It is a real ratified standard (RFC 9562, published in 2024), it is time-sortable, and it indexes cleanly in Postgres, MySQL, and every other B-tree database. The time-sortability is the unsung win — random UUID v4 keys scatter your B-tree because every insert hits a random index page, which means more page splits and worse cache locality on large tables. UUID v7 inserts append at the right edge, just like an auto-incrementing integer, but without the single-writer bottleneck.
UUID v4 is still appropriate for anything where you don't want the timestamp to leak. Session IDs, password reset tokens, OAuth state — these should be pure random. Using v7 here would leak the timestamp of token generation, which is usually fine but occasionally a problem (e.g., revealing when a user signed up via their referral ID).
nanoid is the right call when you need a URL-safe identifier shorter than UUID but with similar collision resistance. A 21-character nanoid has ~149 bits of entropy — comparable to UUID v4's 122 random bits but with 15 fewer characters. Use it for short shareable links, public IDs that show up in URLs, or any context where the human eye will read the ID.
ULID is what you reach for when you want both time-sortability and human readability. The 26-character Crockford Base32 alphabet excludes ambiguous characters (no I, L, O, U) so users can transcribe ULIDs from paper or phone calls without confusion. Great for support-facing reference IDs.
CUID was designed for horizontally scaled systems where multiple servers generate IDs concurrently and want collision resistance without coordination. In practice, UUID v4/v7 do the same job and are more widely supported, so CUID has lost market share. We include it because some Prisma / JavaScript ecosystem teams still use it heavily.
Short slugs exist for one use case: user-facing URLs where length matters more than collision resistance. Bitly. GitHub gists. Imgur. The pattern is always the same — generate slug, attempt insert with a UNIQUE constraint, retry on collision. An 8-character slug from a 36-character alphabet (a-z + 0-9) is ~41 bits of entropy. Fine until you reach hundreds of millions of records, at which point you bump to 10 or 12 characters.
A note on auto-incrementing integers. Sequence-generated IDs are still the right call when you genuinely need them — for example, invoice numbers users will see and reference. The trade-offs versus UUIDs: integers leak business volume (your /invoice/12345 tells a competitor you've issued ~12k invoices), make merging databases harder, and create single-writer bottlenecks at extreme scale. The modern pattern we ship in most builds is: UUID v7 primary key for the database, plus a separate user-facing short number (e.g., invoice 1024) generated by a sequence.
For deeper system design questions — distributed ID generation, sharding, primary-key strategy — see our API development services or book a 20-min architecture call. If you're working through build vs buy decisions, the right ID strategy is one of the foundational choices that determines what your data model can do at scale.
FAQs
When should I use UUID v7 instead of v4?
UUID v7 is time-sortable — the first 48 bits encode the millisecond timestamp. That makes v7 a better default for primary keys in B-tree-backed databases (Postgres, MySQL) because new inserts append at the right end of the index instead of scattering it. Use v4 only when you specifically need non-time-leaking randomness (security tokens, opaque external references). For internal database keys, v7 is the modern recommendation.
Is nanoid safe? It's shorter than UUID.
Yes. A 21-character nanoid using the default URL-safe alphabet has approximately 149 bits of entropy — comparable to UUID v4's 122 random bits. It's shorter (21 vs 36 characters), URL-safe by default, and collision-resistant for billions of IDs. The trade-off is that you lose the human-recognizable UUID format if your operations team is used to it.
What's the difference between ULID and UUID v7?
Both are time-sortable. ULID uses Crockford's Base32 alphabet (no I, L, O, U to avoid confusion) and is always 26 characters. UUID v7 uses standard UUID hex format. ULID is slightly more compact for the same entropy and is human-readable. UUID v7 is a standard (RFC 9562) and has built-in database support. Pick ULID if you're prioritizing readability; pick UUID v7 if you want standard tooling.
Are these IDs cryptographically secure?
Yes. Every ID format on this page uses crypto.getRandomValues — the Web Crypto API's cryptographically secure pseudo-random number generator. The same underlying entropy as crypto.randomUUID. Suitable for session tokens, password reset codes, and any application where unpredictability matters.
Why use short slugs at all if they collide?
Short slugs are great for human-facing URLs (think Bitly, GitHub gists). They're not collision-resistant on their own — an 8-character slug from a 36-character alphabet has only ~41 bits of entropy. The pattern is: generate slug, attempt insert with a UNIQUE constraint, retry with a fresh slug on collision. The shorter the slug, the more retries you'll need at scale.
Related
Related engineering reading
All postsBuilding Multi-Tenant SaaS on Postgres RLS
Row-level security patterns for isolating tenant data without separate databases.
Read postInternal Tools Platform Engineering Guide
Architectural patterns for ops dashboards, admin panels, and back-office UIs.
Read postNext.js + Stripe: The Complete Integration Guide
Server Actions, the Payment Element, webhook idempotency, and subscriptions.
Read post
Picking the wrong ID strategy hurts at scale
We've audited systems where UUID v4 primary keys turned every insert into a B-tree page split. Switching to UUID v7 (or ULID, where tooling supports it) usually unlocks 30-60% write throughput without touching application logic. Talk to us about database design and migration paths.
Or reach us directly: (770) 652-1282 · beltz@quantlabusa.dev