UUID Generator
Generate UUIDs (Universally Unique Identifiers) in different versions and formats. Perfect for databases, APIs, and unique identifier requirements.
Select UUID Version
UUID v1 (Time-based)
Based on timestamp and MAC address
UUID v4 (Random)
Randomly or pseudo-randomly generated
UUID v7 (Time-ordered)
Unix timestamp with random data
Format Options
Standard
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxSimple (No Hyphens)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxWith Braces
{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}With Brackets
[xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx]UUID Information
- UUID v1: Time-based, includes timestamp and MAC address
- UUID v4: Random, most commonly used
- UUID v7: Time-ordered, sortable by creation time
What Are UUIDs and Why Do They Matter?
A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information in computer systems. Standardized by RFC 4122, UUIDs are designed to be unique across space and time without requiring a central registration authority. When represented as text, a UUID consists of 32 hexadecimal digits displayed in five groups separated by hyphens, following the pattern 8-4-4-4-12, for example: 550e8400-e29b-41d4-a716-446655440000.
The total number of possible UUIDs is 2 to the power of 128, which is approximately 3.4 times 10 to the power of 38. This astronomical number means the probability of generating two identical UUIDs is vanishingly small, making them safe to use as primary keys in databases, transaction identifiers in distributed systems, and resource identifiers in APIs without any coordination between generating parties.
UUID Versions Explained
Different UUID versions serve different purposes. UUID v1 is generated using the current timestamp and the MAC address of the machine. This makes v1 UUIDs sortable by creation time, but it also means they can leak information about when and where they were generated. UUID v4 is the most widely used version, generated entirely from random or pseudo-random numbers. It offers 122 bits of randomness, providing excellent uniqueness without exposing any metadata.
UUID v5 generates a deterministic UUID by hashing a namespace and a name using SHA-1, which means the same inputs always produce the same UUID. This is useful when you need reproducible identifiers. UUID v7, a newer addition defined in RFC 9562, embeds a Unix timestamp in the most significant bits followed by random data. This provides both uniqueness and natural chronological sorting, making v7 ideal for database primary keys where index performance matters.
UUID vs Auto-Increment: Choosing the Right Strategy
A common architectural decision is whether to use UUIDs or auto-incrementing integers as primary keys. Auto-increment IDs are simple, compact (typically 4 or 8 bytes), and produce naturally ordered sequences. However, they require a centralized authority (the database) to assign values, which becomes a bottleneck in distributed systems. They also expose information about your data volume and creation order.
UUIDs excel in distributed architectures, microservices, and event-driven systems where multiple nodes need to generate identifiers independently. They can be created client-side before a database insert, enabling offline-first applications and reducing round trips. The tradeoff is size (16 bytes vs 4-8 bytes) and, for random UUIDs like v4, poor index locality in B-tree indexes. UUID v7 addresses the indexing concern by ensuring chronological ordering while retaining the distributed generation benefits.