UUID generator

Random version 4 or time-ordered version 7 UUIDs (RFC 9562), one or ten thousand at a time. Generated on your device with the Web Crypto API.

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

In code, modern runtimes produce v4 natively: crypto.randomUUID() in browsers and Node.js 19+, uuid.uuid4() in Python, gen_random_uuid() in PostgreSQL 13+. PostgreSQL 18 adds uuidv7(). RandomKit’s v7 generator is monotonic within a page: IDs made in the same millisecond still sort in the order they were created.

Questions people ask

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