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.

UUIDs

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.

00000000-0000-0000-0000-000000000000
  • 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

VersionBuilt fromUse it for
v1Timestamp + MAC addressLegacy systems; leaks the machine’s MAC address
v3 / v5MD5 / SHA-1 hash of a namespace and nameStable IDs derived from a name (same input, same UUID)
v4122 random bitsGeneral-purpose unique IDs, tokens, idempotency keys
v6Reordered v1 timestampSortable drop-in for v1
v7Unix ms timestamp + 74 random bitsDatabase primary keys, event IDs, anything sorted by time

Generate a UUID in code

LanguageRandom v4Time-ordered v7 / name-based v5
JavaScriptcrypto.randomUUID()uuid package: v7(), v5(name, ns)
Pythonuuid.uuid4()uuid.uuid7() (3.14+), uuid.uuid5(uuid.NAMESPACE_DNS, name)
JavaUUID.randomUUID()UUID.nameUUIDFromBytes() gives v3; v5/v7 via a library
C# / .NETGuid.NewGuid()Guid.CreateVersion7() (.NET 9+)
Gouuid.New() (google/uuid)uuid.NewV7(), uuid.NewSHA1(ns, name)
PostgreSQLgen_random_uuid()uuidv7() (18+); uuid_generate_v5() via uuid-ossp
Command lineuuidgenuuidgen --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.

Related generators