Utilities

UUID generator

UUID v4 via crypto.randomUUID() in supported browsers.

When UUIDs beat sequential IDs

UUIDs let you assign an ID before insert, merge data from multiple sources without renumbering, and expose opaque keys in URLs. For local prototypes and QA datasets, generating a batch here is faster than importing a library.

Format and standards

RFC 4122 defines versions and variant bits. Version 4 fills most bits randomly; versions 1 and 7 embed time or sortable structure. Match the version your ORM or API contract expects.

Storage and indexing

Random UUIDs fragment B-tree indexes more than sequential integers. Some teams store UUIDs as binary(16) or adopt UUIDv7 for time-ordered clustering. Measure index size if you expect billions of rows.

Security note

UUIDs are identifiers, not secrets. Do not use them alone for session tokens or password-reset links—pair with signed, expiring tokens instead.

FAQ

What is a UUID v4?
A 128-bit identifier with random bits, formatted as 8-4-4-4-12 hex groups. Version 4 is the common choice for opaque primary keys.
Are generated UUIDs guaranteed unique?
Collision risk is astronomically low for practical use, but uniqueness is probabilistic—not absolute. Your database should still enforce a unique constraint.
When should I use UUID instead of auto-increment?
UUIDs shine in distributed systems, client-generated IDs, and public APIs where sequential integers leak volume or merge poorly across shards.