UUID Generator
Generate Universally Unique Identifiers for databases, APIs, distributed systems, and testing. Choose between random v4 UUIDs or time-ordered v7 UUIDs.
- Click Generate to create UUIDs.
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier standardized by RFC 4122. It is written as 32 hexadecimal digits arranged in five groups separated by hyphens: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
UUIDs are designed to be unique across space and time without requiring a central authority. They're generated independently on any machine, making them ideal for distributed systems, microservices, and client-side ID generation before a server round-trip.
UUID v4 vs UUID v7
UUID v4 — Random
122 bits of cryptographically random data. The remaining 6 bits encode the version (4) and variant.
- No embedded timestamp
- Completely unpredictable
- Not sortable by creation time
- Can cause index fragmentation in databases
- Best for: session IDs, correlation IDs, tokens
Example: f47ac10b-58cc-4372-a567-0e02b2c3d479
UUID v7 — Time-ordered
Starts with a 48-bit Unix millisecond timestamp, followed by random bits. Defined in RFC 9562 (2024).
- Sortable chronologically as a string
- Efficient B-tree index insertion
- Timestamp embedded — roughly tells when it was created
- Better for database primary keys than v4
- Best for: database IDs, event IDs, log entries
Example: 018f6e9a-2e18-7000-9b77-3a234f5a6b89
Collision probability
UUID v4 has 122 random bits. The probability of generating two identical UUIDs is astronomically small. To have a 50% chance of a single collision, you would need to generate approximately 2.7 × 1018 UUIDs — roughly one UUID per second for 86 billion years.
For practical purposes, UUIDs are collision-free. You do not need a uniqueness check before inserting one into a database.
Storage and performance tips
- Store UUIDs as
BINARY(16)or a native UUID type (PostgreSQLuuid, MySQL 8UUID) rather thanVARCHAR(36)to save space and speed up indexes. - For MySQL/InnoDB with v4 UUIDs, consider v7 instead — sequential IDs insert at the end of the B-tree rather than fragmenting it.
- Never rely on UUID sort order to mean insertion order unless using v7 or v1 (time-based).
Common uses
- Database primary keys — generate the ID on the client before inserting a row, enabling optimistic UI updates
- Distributed systems — generate IDs across multiple services without coordination
- File names — name uploaded files with UUIDs to avoid collisions and prevent path guessing
- Feature flags and A/B testing — assign stable random IDs to experiment groups
- Testing fixtures — generate unique test IDs in bulk without worrying about conflicts
🔒 Privacy
UUIDs are generated using crypto.randomUUID() (v4) or the uuidv7 library (v7) entirely in your browser. No UUIDs are transmitted or recorded.
Edge cases and limits
- Browser support —
crypto.randomUUID()requires a secure context (HTTPS or localhost). All modern browsers support it. - Quantity limit — generation is capped at 100 per click to keep the UI responsive.
- Uppercase vs lowercase — both are valid representations of the same UUID. Use the toggle to match your codebase's convention.
FAQ
Is UUID v7 widely supported?
UUID v7 was finalized in RFC 9562 in May 2024. Library support is growing quickly in most ecosystems. The format itself is straightforward to implement. For databases, check if your ORM or UUID library has been updated to support v7.
What happened to UUID v1, v2, v3, v5, v6?
v1 uses MAC address + timestamp (privacy concern). v2 is DCE Security (rarely used). v3 and v5 are name-based (deterministic, using MD5 and SHA-1). v6 reorders v1's timestamp for sortability. v7 replaces v6 as the preferred time-based option with simpler construction.
Should I use UUIDs or auto-incrementing integers for primary keys?
Integers are simpler and smaller (4 or 8 bytes vs 16 bytes). UUIDs are better when you need IDs generated off-database, when merging data from multiple sources, or when sequential IDs would leak information (e.g. your 1000th order reveals your scale). UUID v7 closes most of the performance gap with integers in database indexes.