UUID v1 vs v4: What's the Difference and Which Should You Use?

If you've ever generated a UUID and wondered why there are different "versions," here's the short, practical answer — and why it's not just a technicality.

UUID v1: timestamp + machine identity

A v1 UUID is built from the current timestamp and the network (MAC) address of the machine that generated it. That means two things:

  • It's sortable by creation time, roughly — since the timestamp is embedded in the value, v1 UUIDs generated later will differ in a predictable, ordered way.
  • It leaks information. The embedded MAC address can, in principle, be extracted from the UUID — which is a real privacy/security concern if the UUID is ever exposed publicly (like in a URL or an API response). This is the main reason v1 fell out of favor for anything user-facing.

UUID v4: pure randomness

A v4 UUID is generated from (cryptographically) random bits, full stop — no timestamp, no machine identity, nothing embedded that could leak information about when or where it was created. This is why v4 is the default choice almost everywhere today: primary keys in databases, session tokens, request IDs, file names — anywhere you need a unique identifier with no additional information attached.

So which should you use?

Default to v4 unless you have a specific reason not to. The only real case for v1 is when you specifically want IDs that sort roughly chronologically without a separate timestamp field — and even then, most systems solve that better with a dedicated timestamp column plus a v4 UUID, or a purpose-built sortable ID format (like ULID or Snowflake IDs) rather than repurposing v1 for it.

One shared limitation

Neither version guarantees absolute uniqueness — both rely on astronomically low collision probability rather than a mathematical guarantee. In practice, for v4 specifically, the chance of a collision is low enough (you'd need to generate roughly a billion UUIDs per second for about 85 years to have a 50% chance of a single collision) that it's treated as unique in virtually every real-world system.

Generate either version

The UUID Generator produces v1 and v4 UUIDs in bulk, so you can grab a batch for test fixtures or seed data without writing a script for it.

We use cookies to understand how you use the site. No personal data is sold.

UUID v1 vs v4: What's the Difference and Which Should You Use? | Plexto