UUID Generator
Generate universally unique UUID v4 identifiers.
What is a UUID and what is it used for?
A UUID (Universally Unique Identifier) is a standard 128-bit identifier represented as 36 hexadecimal characters separated by hyphens (8-4-4-4-12). The probability of generating two identical UUIDs is astronomically low: approximately 1 in 2^122 for UUIDs v4. This makes them ideal for uniquely identifying resources without needing a central server to coordinate assignment.
There are 5 versions of UUID: v1 (time and MAC-based), v2 (DCE Security), v3 (MD5 hash), v4 (random), and v5 (SHA-1 hash). This tool generates UUIDs v4, which use random numbers and are the most widely used in modern web applications.
Practical use cases
Primary keys in databases: Unlike auto-incremental IDs, UUIDs don't reveal information about data volume and allow generating IDs on multiple servers without conflicts.
Session identifiers: UUID-based session tokens are unpredictable and unique, providing an additional security layer.
Filenames: When uploading user files, using UUIDs as names prevents collisions and prevents file enumeration.
Distributed APIs: Request IDs in UUID format allow tracking requests across multiple microservices in distributed systems.
Frequently asked questions
Is it possible for a UUID to repeat?
The probability is practically zero. Generating 1 trillion UUIDs v4 per second for 100 years, the probability of a single collision would be 50%. In practice, you're more likely to be hit by a meteorite.
UUID vs auto-increment in databases?
UUIDs are better for distributed systems, public APIs, and when you don't want to reveal data volume. Auto-increment is more storage-efficient and better for indexes in monolithic databases. Many systems use both: public UUID and internal ID.
What do the numbers in a UUID mean?
In a UUID v4 like "550e8400-e29b-41d4-a716-446655440000", the third group starts with "4" (indicates version 4) and the fourth group starts with "8", "9", "a" or "b" (indicates variant 1). The rest are random values.
Do UUIDs affect database performance?
Yes, random UUIDs v4 can cause fragmentation in B-tree indexes because they are not sequential. Alternatives like ULID or UUID v7 generate time-ordered IDs that maintain uniqueness and improve index performance.
UUID versions
| Version | Basis | Use |
|---|---|---|
| v1 | Time + MAC | Legacy systems |
| v3 | MD5 hash | Deterministic IDs |
| v4 | Random | General use (most popular) |
| v5 | SHA-1 hash | Secure deterministic IDs |