devopscodepro
Language
Runs entirely in your browser — nothing leaves this page.

UUID / ULID generator

Random UUID v4, time-ordered UUID v7 and ULID — bulk generation with formatting options.

 
RFC 9562 UUID v4 · crypto.getRandomValues

Choosing between v4, v7 and ULID

All three are 128-bit identifiers you can generate without coordinating with anything. The difference is ordering: v4 is entirely random, while v7 and ULID put a millisecond timestamp in the leading bits, so generated ids sort by creation time.

That ordering is not cosmetic. Random primary keys scatter writes across a B-tree index; time-ordered ones append, which is why v7 exists.

Which should I use for a database primary key?

v7, in almost every case. It keeps the uniqueness properties of v4 while writing to the hot end of the index instead of a random page, which shows up as lower write amplification and a smaller working set on any table that grows.

What is the difference between UUID v7 and ULID?

The same idea in two encodings. ULID is 26 characters of Crockford base32 — shorter and case-insensitive, pleasant in URLs. v7 is a standard UUID, so every database type and library already accepts it. Pick ULID for readability, v7 for compatibility.

Does a v7 identifier leak information?

It reveals when the record was created, to the millisecond. Usually harmless, occasionally not — for a public, guessable id where creation time is sensitive, v4 leaks less.

Can two of these collide?

Not in practice. v4 carries 122 random bits and ULID 80 per millisecond; the probability is small enough that hardware failure is the more realistic concern.

Related tools: Timestamp, Password generator and Base64.