UUID generator
Generate a random UUID instantly: version 4 (random), version 7 (time-ordered, best for database keys) or version 5 (name-based), one or 10,000 at a time. Generated on your device with the Web Crypto API, plus a validator that decodes any UUID.
Press generate to fill this table.
Anatomy of a UUID
A UUID is 128 bits written as 32 hex digits. Six of those bits are fixed: four say which version it is, two mark the RFC variant. Version 4 fills the other 122 bits with randomness. Version 7 puts a millisecond timestamp in the first 48 bits, so new IDs sort after older ones, and keeps 74 random bits.
- t Timestamp:
- 7 Version
- v Variant (8–b)
- r Random: 74 bits
Will two ever collide?
The birthday problem gives the odds: with n IDs and b random bits, P ≈ 1 − e−n²/2b+1. For v7 only IDs made in the same millisecond can collide, so the whole-set figure below is a very cautious upper bound.
Chance of any duplicate: practically certain
UUID versions at a glance
| Version | Built from | Use it for |
|---|---|---|
| v1 | Timestamp + MAC address | Legacy systems; leaks the machine’s MAC address |
| v3 / v5 | MD5 / SHA-1 hash of a namespace and name | Stable IDs derived from a name (same input, same UUID) |
| v4 | 122 random bits | General-purpose unique IDs, tokens, idempotency keys |
| v6 | Reordered v1 timestamp | Sortable drop-in for v1 |
| v7 | Unix ms timestamp + 74 random bits | Database primary keys, event IDs, anything sorted by time |
Generate a UUID in code
| Language | Random v4 | Time-ordered v7 / name-based v5 |
|---|---|---|
| JavaScript | crypto.randomUUID() | uuid package: v7(), v5(name, ns) |
| Python | uuid.uuid4() | uuid.uuid7() (3.14+), uuid.uuid5(uuid.NAMESPACE_DNS, name) |
| Java | UUID.randomUUID() | UUID.nameUUIDFromBytes() gives v3; v5/v7 via a library |
| C# / .NET | Guid.NewGuid() | Guid.CreateVersion7() (.NET 9+) |
| Go | uuid.New() (google/uuid) | uuid.NewV7(), uuid.NewSHA1(ns, name) |
| PostgreSQL | gen_random_uuid() | uuidv7() (18+); uuid_generate_v5() via uuid-ossp |
| Command line | uuidgen | uuidgen --sha1 --namespace @dns --name example.com (util-linux) |
RandomKit’s v7 generator is monotonic within a page: IDs made in the same millisecond still sort in the order they were created. Its v5 output matches Python’s uuid.uuid5 for the same namespace and name.
Questions people ask
What is a UUID generator?
A UUID generator creates universally unique identifiers: 128-bit values written as 32 hex digits in the pattern 8-4-4-4-12, such as 3f2b8c1e-7d4a-4c9b-9e21-5a6f0d8b7c43. Each one can be made independently, on any machine, without asking a central server for the next number.
What is a UUID and why is it used?
UUIDs give records, files, messages and API objects an ID that is unique across systems. Unlike auto-increment numbers they can be created offline or on the client, merged between databases without clashes, and don’t reveal how many records you have.
Can I look up a UUID?
No. There is no global registry of UUIDs, which is the point: they are made locally. You can decode what a UUID contains, though. Paste one into the validator on this page to see its version, variant and, for v1, v6 and v7, the time it was created. To find what a UUID refers to, search the system that issued it.
Is a UUID actually unique?
Not guaranteed, but the odds of a duplicate are negligible. A v4 UUID has 122 random bits, so you would need about 2.7 × 10^18 of them for a 50% chance of one collision. In practice, duplicates come from bugs such as a badly seeded random generator, not from chance. Use the collision slider below to see the odds for your volume.
What is UUID v5 used for?
Version 5 hashes a namespace UUID and a name with SHA-1, so the same input always produces the same UUID. That’s useful for stable IDs derived from URLs, domain names or external keys, and for de-duplication. It isn’t random, so don’t use it as a secret.
Should I use UUID v4 or v7?
Use v7 for database primary keys and anything you sort or index: its timestamp prefix keeps B-tree inserts sequential, which PostgreSQL, MySQL and SQL Server handle far better than random v4 keys. Use v4 when you don’t want the ID to reveal when it was created.
Are these UUIDs unique?
Version 4 has 122 random bits. You would need to generate about 2.7 quintillion (2.7 × 10^18) of them for a 50% chance of a single duplicate. They are generated with crypto.getRandomValues, the same source browsers use for crypto keys.
What is UUID v7?
UUIDv7 is defined in RFC 9562 (May 2024), which replaced RFC 4122. It stores a 48-bit Unix timestamp in milliseconds followed by 74 random bits, so IDs are globally unique and roughly time-ordered.
Is a UUID the same as a GUID?
Yes. GUID (globally unique identifier) is Microsoft’s name for the same 128-bit format. Windows and .NET often show GUIDs in uppercase and wrapped in braces; the GUID generator page produces every .NET format.
Can I tell when a UUID was created?
For v1, v6 and v7, yes: the timestamp is embedded. Paste one into the inspector on this page to decode it. Version 4 UUIDs contain no time information.