UUID Generator

Generate v4 (random) or v7 (time-ordered) UUIDs in bulk.

Runs in your browser — nothing is uploaded

 

What a UUID is

A UUID (universally unique identifier, called a GUID in the Microsoft world) is a 128-bit value written as 32 hexadecimal digits in five groups, like 3f2b8c1e-9d4a-4f6b-8e21-7c5d0a9b1e34. UUIDs let separate systems create IDs independently, with no central counter, and still never collide in practice.

The digit after the second hyphen is the version. This generator produces version 4 and version 7, the two versions worth using for new work.

v4 or v7?

A v4 UUID is 122 bits of randomness, generated here with the browser's cryptographically secure crypto.randomUUID(). Use it when IDs should reveal nothing, such as public identifiers or tokens in URLs.

A v7 UUID starts with a 48-bit Unix timestamp in milliseconds, followed by random bits. Because they sort by creation time, v7 IDs make far better database primary keys than v4: new rows land near the end of a B-tree index instead of at random positions, which keeps inserts fast and indexes compact. Ordering is only to the millisecond: IDs generated within the same millisecond, as in a bulk batch here, sort randomly among themselves. The trade-off is that a v7 ID reveals roughly when it was created.

Bulk generation

Set a count of up to 1,000 to generate a batch at once, one UUID per line, ready to paste into a seed file, a spreadsheet or a test fixture. Everything is generated locally in your browser; nothing is sent to or stored on a server.

How to use

  1. Choose v4 or v7.
  2. Set how many to generate.
  3. Copy the UUIDs.

FAQ

Can two UUIDs ever be the same?

In theory yes, in practice no. With 122 random bits, you would need to generate billions of v4 UUIDs per second for many decades before a collision became likely.

Is a UUID the same as a GUID?

Yes. GUID is Microsoft's name for the same 128-bit format. Some Microsoft tools display GUIDs in uppercase or wrapped in braces, but the value is identical.

Should I use v7 for database primary keys?

Usually, yes. Time-ordered v7 IDs insert in roughly ascending order, which avoids the index fragmentation random v4 keys cause in B-tree indexes such as those in PostgreSQL and MySQL.

How do I generate a UUID in code?

In browsers and Node.js, call crypto.randomUUID() for a v4 UUID. In Python, use uuid.uuid4(). In PostgreSQL 13 and later, use gen_random_uuid(). Native v7 support is newer, so many languages still need a library for it.

Related tools