UUID v4 Generator
Generated locally in your browser with crypto.getRandomValues. Nothing is sent to a server.
What is a UUID?
A UUID (Universally Unique Identifier), also called a GUID, is a 128-bit identifier written as 32 hex digits in five groups:
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. Because they can be generated independently without a central authority,
UUIDs are ideal for database keys, request IDs, file names and distributed systems.
In a version 4 UUID, the 4 marks the version and y is one of 8, 9, a or b (the variant).
The remaining 122 bits are random.
UUID versions
| Version | Based on | Typical use |
|---|---|---|
| v1 | Timestamp + MAC address | Legacy; leaks the machine and time |
| v3 / v5 | MD5 / SHA‑1 hash of a namespace + name | Deterministic IDs for the same input |
| v4 | Random numbers | The most common general-purpose UUID |
| v7 | Unix timestamp + random | Time-ordered IDs, friendlier to database indexes (RFC 9562) |
Can two UUIDs collide?
In theory yes, in practice no. With 122 random bits you would need to generate roughly 2.7 × 1018 UUIDs to reach a 50% chance of a single duplicate — about a billion per second for 86 years.
Generate UUIDs in code
| JavaScript | crypto.randomUUID() |
| Python | import uuid; uuid.uuid4() |
| PostgreSQL | SELECT gen_random_uuid(); |
| Linux / macOS | uuidgen |
| Java | UUID.randomUUID() |
Frequently asked questions
What is a UUID v4?
A 128-bit identifier where 122 bits are random and the rest encode the version (4) and variant. It is the most widely used UUID type.
What is the difference between a UUID and a GUID?
None in practice. GUID is Microsoft’s name for the same 128-bit identifier format.
Are generated UUIDs really unique?
Collisions are astronomically unlikely when a cryptographically secure random generator is used, as this tool does (crypto.getRandomValues).
Should I use UUID v4 or v7 as a database primary key?
v7 UUIDs are time-ordered, so they insert into B-tree indexes more efficiently. v4 is fine for most apps and reveals nothing about creation time.
Are UUIDs case-sensitive?
No. The hex digits may be upper- or lowercase; RFC 9562 recommends lowercase output and case-insensitive comparison.
Is generation done offline?
Yes. UUIDs are generated in your browser and never sent anywhere.