Back to Home
Published: June 2026By Web Util Slyce Team7 min read

UUID Versions — v1 vs v4 vs v5 vs v7

A complete guide to UUID (Universally Unique Identifier) versions. Generate UUIDs instantly with our UUID Generator.

UUID Format

A UUID is a 128-bit identifier displayed as 32 hexadecimal digits separated by hyphens:

xxxxxxxx-xxxx-Vxxx-xxxx-xxxxxxxxxxxx
// V = version number (1, 4, 5, 7, etc.)

Example: 550e8400-e29b-41d4-a716-446655440000

Version Comparison

VersionMethodUnique PerSortableBest For
vv1Timestamp + MAC addressNode + timeYesDistributed systems, tracking creation order
vv4Random (122 bits)RandomnessNoGeneral-purpose, primary keys, session IDs
vv5SHA-1 hash of namespace + nameNamespace + nameNoDeterministic IDs from a name/URL
vv7Timestamp + randomTime + randomnessYesDatabase primary keys (time-ordered indexes)

UUID v4 (Random)

The most commonly used UUID version. Uses 122 random bits, providing excellent uniqueness without requiring any centralized coordination.

550e8400-e29b-41d4-a716-446655440000f47ac10b-58cc-4372-a567-0e02b2c3d4796ba7b810-9dad-11d1-80b4-00c04fd430c89b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d

UUID v7 (Time-Ordered)

A newer UUID version (RFC 9562) that combines a Unix timestamp with random bits. Time-ordered UUIDs are sortable by creation time, making them ideal for database primary keys and indexes.

018f3a6e-1b3c-7a45-9bcd-123456789abc018f3a6e-2d4e-7b56-acde-23456789abcd018f3a6e-3f5g-7c67-bdef-3456789abcde018f3a6e-4a6h-7d78-cef0-456789abcdef

UUID v5 (SHA-1 Hash)

Deterministic UUID generated from a namespace and name using SHA-1 hashing. The same input always produces the same UUID, useful for creating consistent identifiers from URLs, DNS names, or object IDs.

Namespace: DNS (6ba7b810-9dad-11d1-80b4-00c04fd430c8)
Name: "example.com"
Result: cf23df22-7f6b-4a5e-9e4a-8a4b8e5c9d7a

Which UUID Version Should You Use?

UUID v4

You need a simple, unique ID with no ordering requirements. Best for most applications including session IDs, transaction IDs, and general-purpose identifiers.

UUID v7

You need time-ordered primary keys for databases. v7 prevents index fragmentation in B-tree indexes and is the recommended choice for new systems.

UUID v5

You need deterministic IDs — generating the same ID for the same input every time. Useful for content-addressable storage or linking resources.

UUID v1

You need time-ordering including the specific node (MAC) that generated it. Less common now that v7 is standardized.