UUID Versions Explained: v1, v4, and v7

"UUID" is a family of formats, not one thing. The version digit (the first character of the third group) tells you how it was made. Here are the three you'll actually use.

UUID v4 — random

The most common. 122 random bits, no meaning, no order.

550e8400-e29b-41d4-a716-446655440000
            ^ the "4" marks version 4

Use it for: general-purpose unique IDs where you don't need ordering. This is the default choice.

UUID v1 — time + MAC address

Built from a timestamp and the machine's MAC address. Roughly sortable by time, but it can leak the MAC address and creation time, which is a privacy concern.

Use it for: legacy systems that require it. Most new code avoids it.

UUID v7 — time-ordered random

The modern best-of-both. The first bits are a Unix millisecond timestamp, the rest are random. So v7 UUIDs are sortable by creation time while staying collision-resistant and privacy-safe.

Use it for: database primary keys. The time ordering dramatically improves index performance compared to v4's randomness.

Quick guide

VersionBased onSortablePrivacyBest for
v1time + MACroughlyleaks MAClegacy
v4randomnogoodgeneral use
v7time + randomyesgoodDB keys

Generate them

The UUID generator creates v4 UUIDs instantly in your browser.

Got a config file to check?

Open the config toolkit →