WW Tools
All references

UUID Versions Reference

A UUID is a 128-bit identifier. The version nibble in the third group records how it was generated. These are the versions defined by RFC 9562 (which superseded RFC 4122).

VersionGenerated fromTime-orderedTypical use
v1Timestamp + node (MAC)RoughlyLegacy time-based ids
v3MD5 of a namespace + nameNoDeterministic ids from a name
v4RandomNoGeneral-purpose unique ids
v5SHA-1 of a namespace + nameNoDeterministic ids (preferred over v3)
v6Reordered v1 timestampYesSortable, v1-compatible
v7Unix epoch (ms) + randomYesSortable keys for databases

Frequently asked questions

Which UUID version should I use?

Use v4 for general unique identifiers, and v7 when you want database keys that sort by creation time. Use v5 when the id must be reproducible from a name.

Is UUID v7 better than v4 for database primary keys?

Often yes. v7 embeds a millisecond timestamp in its leading bits, so new ids are roughly sequential. That reduces index fragmentation compared to fully random v4.

Use the tool