UtilityNest

UUID Generator

Make one UUID or a thousand in a click. Pick random version 4 or time-ordered version 7, choose the format your code or database expects, then copy or download. Paste any UUID below to see its version and when it was made.

Version

d72aaf51-91b6-41f1-97e6-da499ab6accd

Check a UUID

Need the nil UUID?

How to use UUID Generator

  1. 1Pick v4 (random) or v7 (time-ordered).
  2. 2Choose how many, from 1 to 1,000.
  3. 3Set the format: uppercase, hyphens, braces, quotes or commas.
  4. 4Copy the result or download it as a .txt file.
  5. 5Paste any UUID into Check a UUID to read its version and time.

v4 or v7: which one to pick

Version 4 is 122 random bits with no meaning. Use it for anything that should not reveal when it was made: invite codes, API keys you also hash, public links, test data.

Version 7 starts with the creation time in milliseconds, then adds random bits. Because the time comes first, v7 IDs sort in the order they were made. That makes them a good primary key in databases such as PostgreSQL, MySQL and SQL Server, where random v4 keys scatter new rows across the index and slow inserts on big tables. The trade-off: anyone who sees a v7 ID can read the time it was created.

v4v7
Random bits12274
Sorts by creation timeNoYes
Reveals when it was madeNoYes, to the millisecond
Best forTokens, public IDsDatabase keys, logs, events

What we measured

We generated batches of 1,000 in a desktop browser and checked them:

  • 1,000 IDs take under 10 milliseconds for either version, so the page never makes you wait.
  • Every batch had 1,000 unique values.
  • A batch of 1,000 v7 IDs made within the same few milliseconds still came out in exact sort order. Within one millisecond the generator counts up in the 12 bits after the version digit, as RFC 9562 allows, so a batch never shuffles.
  • The .txt download of 1,000 IDs with hyphens is about 36 KB, one ID per line.

The UUID checker below the generator reads the creation time back from v7, v6 and v1 IDs. We tested it on the example IDs printed in RFC 9562 and it returned their stated time, February 22, 2022, 19:22:22 UTC.

Formats for code and databases

The switches change how the same IDs are written, without generating new ones:

  • Lowercase with hyphens (the default) is the standard text form. PostgreSQL, JavaScript and most APIs expect it.
  • UPPERCASE with {braces} matches how Windows, the registry and .NET GUIDs are usually shown.
  • No hyphens gives 32 hex characters, handy for file names or columns stored as text.
  • "Quotes" and commas turn a batch into a list you can paste straight into a SQL IN (...) clause, a JSON array or code.

Your settings are remembered on this device, so the next visit starts with the same format.

Can two UUIDs ever be the same?

In practice, no. A v4 UUID has 122 random bits. You would need to make about 2.7 quintillion of them before there is a 50% chance of a single repeat, which at one billion per second takes around 86 years. This page uses the browser's secure random source (crypto.getRandomValues), not Math.random, so the values are not predictable. Nothing is sent to a server: the IDs are made and stay on your device.

Reading a UUID by eye

A UUID is 32 hexadecimal digits in five groups (8-4-4-4-12). Two positions tell you what kind it is:

  • The first digit of the third group is the version: 4 for random, 7 for time-ordered, 1 for the older time-and-hardware kind.
  • The first digit of the fourth group is the variant. For standard UUIDs it is 8, 9, a or b.

Take the example from the UUID standard, RFC 9562: 017f22e2-79b0-7cc3-98c4-dc0c0c07398f. The third group starts with 7, so it is version 7, and the fourth starts with 9, a standard variant. The first 12 digits, 017f22e279b0, are a millisecond timestamp: 1,645,557,742,000 ms after 1970, which is 22 February 2022 at 19:22:22 UTC. Paste it into the checker under the generator and you get the same date. A v4 UUID has no such timestamp; its digits are random apart from the version and variant.

Storing UUIDs in a database

As text, a UUID takes 36 characters. As a number it is only 16 bytes, so storage and indexes are less than half the size when you use a native type:

  • PostgreSQL has a uuid column type that stores the 16 bytes and accepts the standard text form directly.
  • MySQL 8 has no UUID type; store it in BINARY(16) and convert with UUID_TO_BIN() and BIN_TO_UUID().
  • SQL Server uses uniqueidentifier, which is why the braces format exists.
  • SQLite has no special type; text works, or a 16-byte blob if size matters.

For a primary key, v7 is the friendlier choice: new rows get larger values, so they land at the end of the index instead of being scattered across it the way random v4 keys are.

Frequently asked questions

Is a GUID the same as a UUID?

Yes. GUID is Microsoft's name for the same 128-bit format. Turn on UPPERCASE and Braces to get the {XXXXXXXX-...} style Windows tools show.

Should I use UUID v7 as a primary key?

Usually yes, if the creation time is not secret. v7 values sort by time, so new rows land at the end of the index instead of all over it. PostgreSQL 18 can also make them itself with uuidv7().

How many UUIDs can I make at once?

Up to 1,000 per batch. Copy them all or download a .txt file with one per line, and press Generate again for another batch.

What is the nil UUID?

00000000-0000-0000-0000-000000000000, all zeros. It is used as an empty placeholder. The max UUID, all F, is its opposite. The checker recognises both.

Can I tell when a UUID was created?

Only for time-based versions. Paste a v7, v6 or v1 UUID into the checker to see its creation time. A v4 UUID holds no time at all.

How can I tell which version a UUID is?

Look at the first digit of the third group: 4 means random (v4), 7 means time-ordered (v7). Paste any UUID into the checker on this page to see its version, and for v7, the date and time it was made.

Should I store UUIDs as text or binary?

Use the database's native type where it has one (uuid in PostgreSQL, uniqueidentifier in SQL Server), or BINARY(16) in MySQL. It takes 16 bytes instead of 36 characters.