UUID v4 vs v7 vs ULID: picking the right ID

UUID v4 is the classic: 122 bits of pure randomness, zero coordination, collisions so unlikely you can ignore the math. Its flaw shows up at scale — random IDs scatter across database indexes, fragmenting B-trees and slowing inserts as tables grow.

UUID v7 and ULID fix that by leading with a timestamp: new IDs sort after old ones, so database indexes stay compact and inserts stay fast. v7 keeps UUID formatting and compatibility; ULID packs the same idea into 26 Crockford-base32 characters. Random where it helps, ordered where it matters.

Open the free UUID / ULID Generator — no signup, runs entirely in your browser.

How to use it

  1. Pick a format: v4 for random, v7 or ULID for time-ordered.
  2. Set how many you need — one or a thousand.
  3. Generate and copy; uppercase and hyphen options are one toggle away.

Why this one

  • UUID v4, UUID v7 and ULID from one generator.
  • Bulk generation up to 1,000 IDs per run.
  • v7 and ULID are monotonic within the same millisecond — ordering holds even in bursts.
  • Uppercase output and hyphen-free UUIDs on demand.

Frequently asked questions

Which ID should I use for database primary keys?

v7 or ULID. Their time-ordered prefix keeps index inserts append-only, avoiding the page splits and fragmentation random v4 IDs cause in large tables. v4 is fine for smaller tables and non-indexed identifiers.

What are the odds of a UUID collision?

For v4: generating a billion IDs per second for about 85 years gives a 50% chance of a single collision. Not a practical concern — v7 adds a timestamp on top, making collisions structurally even harder.

What does monotonic mean for UUID v7 and ULID?

IDs created within the same millisecond still sort in creation order: the random part increments instead of re-randomizing. Sort by ID and you sort by time — even under heavy concurrent generation.