← All tools

UUID (v4) generator

Generate as many random UUIDs as you need and copy them. Nothing is sent to a server.

Action

What is a UUID and what is it for?

A UUID (Universally Unique Identifier) is a 36-character ID such as 3f1c9a2e-7b4d-4c1a-9e8f-2a6b5d0c7e14. Its purpose is to create a value that is unique everywhere without a central counter. The ID of a database row, an uploaded file, an order or an API request is very often a UUID.

Unlike sequential numbers (1, 2, 3...), separate servers or apps can create UUIDs at the same time without coordinating. And a URL like /orders/3f1c9a2e-... instead of /orders/1052 makes it much harder for others to guess other records.

When this tool is useful

Use it to prepare test data, add records to a database by hand, write unique keys into configuration files or get sample IDs when trying out an API. You can generate up to 500 UUIDs at once and copy them one per line, which is a quick way to fill a spreadsheet or a CSV file.

Some systems want UUIDs in uppercase (common in Microsoft products), others as 32 characters without dashes. Both options are available.

How a v4 UUID is built

122 of the 128 bits of a v4 UUID are random. The first digit of the third group is always 4, marking the version, and the first digit of the fourth group is 8, 9, a or b. This tool uses your browser's secure random number generator (crypto.getRandomValues), the same one used for cryptography.

122 random bits give about 5.3 × 10^36 possible values. Even generating billions of UUIDs per second, the chance of a collision is practically zero.

Things to keep in mind

A UUID is an identifier, not a password. Even though it is hard to guess, it should not be the only protection for something secret such as a password reset link; use tokens that expire and are checked on the server for that.

On very large tables, random v4 values are scattered across the index and can slow down inserts. In that case a time-ordered UUID v7, or an internal integer key, may be a better fit.

How to use it

  1. Enter a count (up to 500).
  2. Optionally turn on UPPERCASE or No dashes.
  3. Copy the result. Use Generate again for new values.

Frequently asked questions

Is UUID v4 really random?

Yes, it uses your browser's secure random number generator.

Can two UUIDs collide?

In practice no. The chance of two v4 UUIDs being equal is negligible.

Are UUID and GUID the same thing?

Yes, GUID is the name Microsoft uses. The format is the same.

What does a v4 UUID look like?

It is 32 hexadecimal digits in five groups, 8-4-4-4-12, for example 3f1c9a2e-7b4d-4c1a-9e8f-2a6b5d0c7e14. The first digit of the third group is always 4 (the version), and the first digit of the fourth group is 8, 9, a or b (the variant). The other 122 bits are random.

How do I generate a UUID in code?

JavaScript: crypto.randomUUID(). Python: import uuid; uuid.uuid4(). PostgreSQL: gen_random_uuid(). MySQL: UUID() returns a v1 UUID, so generate v4 values in your application if you need random ones. C#: Guid.NewGuid(). PHP (Laravel): Str::uuid().

What is the difference between UUID v1, v4 and v7?

v1 is built from a timestamp and the machine's address, v4 is fully random, and v7 starts with a Unix timestamp followed by random bits, so v7 values sort by creation time. v4 is the most widely used when you just need a unique ID.

Should I use a UUID as a database primary key?

It works and avoids exposing sequential IDs, but random v4 values are spread across the index, which can slow inserts on very large tables. Many teams use v7 or keep an integer key internally and expose the UUID publicly.

Related tools