UUID Beautifier

UUID Versions

UUID Versions Explained

The UUID specification defines several versions, each with different generation strategies and trade-offs. Understanding these versions helps you choose the right one for your use case. The version number is encoded in the third group of the UUID (the M in xxxxxxxx-xxxx-Mxxx-xxxx-xxxxxxxxxxxx).

Version Generation Best For
v1 Timestamp + MAC address Legacy systems, temporal sorting
v4 Random Most use cases (default choice)
v5 SHA-1 hash of namespace + name Deterministic identifiers
v7 Unix timestamp + random Database keys, time-ordered IDs

UUID v1 — Time-Based

UUID v1 is generated using the current timestamp (100-nanosecond intervals since October 15, 1582) and the MAC address of the machine generating it. This makes v1 UUIDs sortable by creation time, but it also means they can reveal where and when they were created — a privacy concern.

Pros: Time-sortable, guaranteed unique via MAC address.

Cons: Exposes machine identity (MAC address), not ideal for security-sensitive contexts. Also, clock skew or MAC address reuse can cause collisions in theory.

Example: 6ec1bd70-e89b-11d3-a456-426614174000

UUID v4 — Random

UUID v4 is the most commonly used version. It is generated using random or pseudo-random numbers, with 122 bits of randomness. The probability of two v4 UUIDs colliding is approximately 1 in 2.71 × 1018, making collisions effectively impossible for any practical use.

Pros: Simple, no predictable pattern, suitable for virtually all use cases.

Cons: Not sortable by creation time, can cause index fragmentation in databases when used as primary keys.

Example: 550e8400-e29b-41d4-a716-446655440000

UUID v5 — Namespace-Based (Deterministic)

UUID v5 generates a deterministic identifier by hashing a namespace UUID and a name string using SHA-1. The same namespace and name will always produce the same UUID, which is useful for creating consistent, reproducible identifiers across systems.

Pros: Deterministic — useful for deduplication and consistent identifiers across systems.

Cons: Not random, so it does not provide uniqueness guarantees for arbitrary names. Uses SHA-1, which while still safe for UUID generation, is not recommended for security-sensitive hashing.

Well-known namespaces:

  • 6ba7b810-9dad-11d1-80b4-00c04fd430c8 — DNS
  • 6ba7b811-9dad-11d1-80b4-00c04fd430c8 — URL
  • 6ba7b812-9dad-11d1-80b4-00c04fd430c8 — OID
  • 6ba7b814-9dad-11d1-80b4-00c04fd430c8 — X.500 DN

UUID v7 — Unix Timestamp (Recommended)

UUID v7 is the newest proposed standard. It starts with a 48-bit Unix timestamp (millisecond precision) followed by random bits. This design provides the best of both worlds: time-sortability for database indexing and randomness for uniqueness.

Pros: Time-sortable (good for database indexes), random enough to avoid collisions, does not expose machine identity.

Cons: Newer standard — not yet universally supported in all libraries and databases.

Example: 0190a5c0-e89b-7d3a-a456-426614174000

Which Version Should You Use?

  • Default choice: Use v4 for most general-purpose identifiers
  • Database primary keys: Prefer v7 for better index performance
  • Deterministic IDs: Use v5 when you need the same input to always produce the same UUID
  • Legacy / temporal: Use v1 only for compatibility with existing systems

You can generate v1, v4, v5, and v7 UUIDs right now using our UUID Generator tool — or format raw strings with our UUID Formatter.

We use cookies for theme preferences, analytics, and advertising. Read our Privacy Policy