UUID Generator
v4 · single · bulk · copy
$ how-to-use
Click Generate to create a new UUID. Generate multiple at once for batch needs. Click any UUID to copy it to your clipboard.
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier formatted as 32 hex digits in 5 groups: 550e8400-e29b-41d4-a716-446655440000. The probability of generating two identical UUIDs is astronomically low — roughly 1 in 5.3×10^36.
UUIDs solve a fundamental problem in distributed systems: generating unique IDs without a central authority. Multiple servers, clients, or services can all generate UUIDs independently with virtual certainty that none will collide.
Version 4 UUIDs (what this tool generates) use random/pseudo-random numbers for 122 of the 128 bits, with 6 bits reserved for version and variant information.
Common Use Cases
Database Primary Keys
UUIDs as primary keys avoid sequential ID guessing and work across distributed databases without coordination.
API Request IDs
Attach a UUID to each API request for tracing and debugging across microservices and log aggregation systems.
Session Tokens
Random UUIDs make unpredictable session identifiers, preventing session hijacking through ID guessing.
File Naming
Uploaded files renamed with UUIDs prevent conflicts and avoid exposing original filenames in public URLs.
UUID Versions Compared
Not all UUIDs are created equal. Different versions serve different purposes. Here's how they compare.
| Version | Source | Sortable | Deterministic | Best For |
|---|---|---|---|---|
| v1 | Timestamp + MAC address | Partially | No | Legacy systems, Cassandra |
| v3 | MD5 hash of namespace + name | No | Yes | Consistent IDs from names |
| v4 | Random / CSPRNG | No | No | General purpose (most common) |
| v5 | SHA-1 hash of namespace + name | No | Yes | Consistent IDs (preferred over v3) |
| v7 | Unix timestamp + random | Yes | No | Database PKs, event ordering |
UUID vs Alternative ID Formats
UUID v4
Length: 36 chars (with hyphens)
Bits: 122 random bits
Sortable: No
Standard: RFC 4122 — universal support
Best for: Maximum compatibility
ULID
Length: 26 chars (Crockford Base32)
Bits: 48 timestamp + 80 random
Sortable: Yes (lexicographic)
Standard: Community spec
Best for: Time-ordered data, databases
nanoid
Length: 21 chars (default, configurable)
Bits: ~126 random bits
Sortable: No
Standard: No (library-specific)
Best for: URL-safe short IDs, frontend
CUID2
Length: 24 chars (default)
Bits: Cryptographically random
Sortable: No
Standard: No (library-specific)
Best for: Security-sensitive, anti-enumeration
UUIDs in Databases
Using UUIDs as primary keys has trade-offs. Random v4 UUIDs cause index fragmentation in B-tree indexes because inserts happen at random positions rather than appending to the end. This slows down write-heavy workloads, particularly in MySQL with InnoDB and PostgreSQL with standard B-tree indexes.
Solutions include using UUID v7 (time-sorted, so new IDs always append), storing UUIDs as BINARY(16) instead of CHAR(36) to save 56% storage, or using the database's native UUID type (PostgreSQL has a built-in uuid type that stores efficiently). Some databases like CockroachDB and Vitess are optimized for random UUID keys.
For read-heavy workloads with moderate writes, v4 UUIDs work fine. The fragmentation penalty is most noticeable at very high insert rates (thousands per second) on traditional RDBMS systems.
FAQ
Are UUIDs truly unique?
Practically yes. The chance of collision is so low it's considered impossible in practice. You'd need to generate 1 billion UUIDs per second for about 85 years to have a 50% probability of a single collision.
UUID vs ULID vs nanoid?
UUIDs are the standard — universally supported. ULIDs are sortable by timestamp. nanoid is shorter (21 chars vs 36) and faster. Choose based on your needs: compatibility (UUID), sorting (ULID), or compactness (nanoid).
Is generation truly random?
This tool uses crypto.randomUUID() which leverages your system's cryptographically secure random number generator. It's suitable for security-sensitive applications.