UUID versions overview (v1, v3, v4, v5, v7)
A comparison of how each UUID version is created and when to use it.
Time-based — v1
Generated from a timestamp and a node (MAC address). It carries ordering information, but MAC-exposure concerns mean it is increasingly being replaced by v7.
Name-based — v3 and v5
Deterministic UUIDs made by hashing a namespace and a name. The same input always yields the same result. v3 uses MD5, while v5 uses SHA-1.
Random — v4
The most common version, built from 122 random bits. It is simple, has an extremely low collision probability, and is well suited for general use.
Time-sorted — v7
It stores Unix milliseconds up front so it is sortable yet unique. As the latest RFC 9562 standard, it is recommended for new systems.