Toollit

UUID Generator

Generate and validate UUIDs by version. Supports v1, v3, v4, v5, v7.

9d4ed242-18f3-4c79-9827-bc6a2b723cdc

UUID Validator

UUID Version Comparison

VersionBasisUniquenessSortableRecommended Use
v1Timestamp + MACTime + NodeOLogging, events
v3MD5 hashDeterministicXURL/name mapping
v4RandomStatisticalXGeneral unique ID
v5SHA-1 hashDeterministicXNamespace mapping
v7Timestamp + RandomTime + RandomODB primary key

Detailed UUID Version Descriptions

v1 — Timestamp-based

UUID v1 is created by combining the current time (100-nanosecond precision) with the generating device's MAC address. Since it contains time information, it can be sorted by creation order, and even simultaneous generation on the same device prevents collisions through clock sequence.

However, there are privacy concerns as the MAC address is exposed. Most modern implementations use random node IDs instead of actual MAC addresses, but v4 or v7 are recommended for externally exposed identifiers.

v3 — MD5 Namespace Hash

UUID v3 calculates an MD5 hash by combining a namespace UUID with a name string. It's a deterministic approach where the same namespace + same name always generates the same UUID.

Useful for converting fixed inputs like URLs or domain names to unique identifiers. However, due to MD5's security vulnerabilities, SHA-1 based v5 is recommended for new projects.

v4 — Completely Random

UUID v4 consists of 122 bits of pure random data and is the most widely used UUID version. Using cryptographically secure random number generators (CSPRNG), the collision probability is extremely low.

Without time information, sorting is impossible, and random insertion in database B-Tree indexes can cause performance degradation. Suitable for general unique identifiers where sorting isn't needed.

v5 — SHA-1 Namespace Hash

UUID v5 uses the same deterministic approach as v3 but with SHA-1 as the hash algorithm. Same namespace + same name always generates the same UUID, with higher collision resistance than MD5.

V5 is recommended over v3 when you need reproducible identifiers from fixed inputs.

v7 — Latest Standard (RFC 9562)

UUID v7 is a new UUID version defined in RFC 9562, published in 2024. The upper 48 bits contain a Unix timestamp (milliseconds), with the rest being random data. Since the timestamp is in the upper bits, lexicographic sorting = chronological sorting.

Unlike v1, it doesn't use MAC addresses, so there are no privacy concerns. Like v4, it has randomness but sorts chronologically. When used as a database primary key, sequential insertion into B-Tree indexes significantly improves write performance compared to v4.

For new projects, v7 is the best choice for DB primary keys or sorted identifiers.

Which Version Should You Use?

General Unique Identifiers

If sorting isn't needed, v4 is the most versatile. Most libraries generate v4 by default.

DB Primary Key, Needs Sorting

If chronological sorting and index performance are important, v7 is recommended. Also safe for distributed systems.

Same Input → Same UUID

Use v5 for deterministic UUIDs. V3 works too, but SHA-1 based v5 is recommended.