Skip to content
ForgePlug — Logo
All guides
Developeruuididentifiersdatabase

What Is a UUID? A Practical Guide to v4, v1, and v7

Universally Unique Identifiers let distributed systems generate unique keys without coordination. Learn the difference between UUID v4, v1, and v7 — and which one you should use.

ForgePlug TeamJuly 25, 20266 min read

Every distributed system eventually needs to answer one question: how do I generate a unique identifier without asking a central database for permission? The classic answer is an auto-incrementing integer, but that requires coordination, reveals cardinality, and leaks information. A UUID — Universally Unique Identifier — solves all three problems at once.

What a UUID actually is

A UUID is a 128-bit identifier, typically written as a 36-character string in the format 8-4-4-4-12 — for example, 550e8400-e29b-41d4-a716-446655440000. The uniqueness doesn't come from checking against a central registry; it comes from the sheer size of the space and how the bits are generated. With 122 random bits of entropy in the most common version, the odds of a collision are astronomically small.

  • v4 — fully random. The best default for almost everything.
  • v1 — timestamp + node identifier. Rough chronological ordering, but leaks the generating machine.
  • v7 — timestamp + randomness. Sortable like v1 without the privacy trade-off, and the modern recommendation.

Why version 7 is taking over

UUID v7 embeds a millisecond timestamp at the front, so records are naturally sortable — which plays perfectly with database indexes and event streams where v4's randomness causes index fragmentation.

Where UUIDs shine

  • Database primary keys — no counter, no coordination, merge-friendly.
  • API resource IDs — safe to expose, impossible to enumerate.
  • Idempotency keys — let clients retry safely without duplicate side effects.
  • Event and log correlation — generated independently across services.

The catch is that you should generate UUIDs using a cryptographically secure random source, not a predictable one. Math.random-based generators can repeat under load — a silent, intermittent bug that's miserable to debug.

Generate UUIDs the right way

ForgePlug's UUID Generator creates v1, v4, and v7 IDs using your browser's Web Crypto API, validates any UUID you paste, and exports batches up to 100 in TXT, CSV, or JSON.

Open UUID Generator

When NOT to use a UUID

UUIDs are 16 bytes — four times larger than a 32-bit integer. On enormous tables with hundreds of millions of rows, that extra size costs storage and slows index scans. If you truly never merge data sets and never expose IDs, a plain integer is fine. For almost everything else, a UUID — especially v7 — is the safer default.

More Developer guides

Keep learning — every guide pairs with a free, browser-based tool.