Mini Tools

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

VersionBased onTypical use
v1Timestamp + MAC addressLegacy; leaks the machine and time
v3 / v5MD5 / SHA‑1 hash of a namespace + nameDeterministic IDs for the same input
v4Random numbersThe most common general-purpose UUID
v7Unix timestamp + randomTime-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

JavaScriptcrypto.randomUUID()
Pythonimport uuid; uuid.uuid4()
PostgreSQLSELECT gen_random_uuid();
Linux / macOSuuidgen
JavaUUID.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.