UUID v1 vs v4 vs v7 — Which Version to Choose?

RFC 4122 defines several UUID versions. The three you'll see most often are v1 (time-based), v4 (random), and v7 (time-ordered). Here's a quick comparison to help you choose.

Version 1 — Time-Based

Version 1 UUIDs encode a timestamp and a node (often derived from MAC in servers; in browsers it's random). They're unique and roughly time-ordered. Use v1 when you need time ordering or legacy compatibility. Drawbacks: timestamp and node can leak information; ordering is only approximate.

Version 4 — Random

Version 4 UUIDs are generated from random data. They're the most common choice for new applications: session IDs, record IDs, tokens. No time or machine component, so they're safe across distributed systems. Use v4 when you just need a unique ID and will store it. Our generator and API default to v4.

Version 7 — Time-Ordered

Version 7 (draft RFC 9562) combines a millisecond timestamp with random data. UUIDs are sortable by creation time, which helps database indexes and time-based queries. Use v7 when you want both uniqueness and natural time order without v1's complexity.

Quick Comparison

Need many at once? Use our bulk generator. To check a string, use our validator.

When to use v4 vs v5 · What is UUID v7? · Home