🆔

UUID Generator

Generate cryptographically secure version 4 UUIDs singly or in bulk. Uses the Web Crypto API, runs in your browser, download as a file.

✓ Free forever✓ No signup✓ 100% private — runs in your browser
UUID / GUID Generator
Generate cryptographically secure UUID v4s in bulk. Multiple formats supported.
Version
Count (1–1000)
Format

A UUID is a 128-bit identifier designed to be unique without any central coordination. Any number of systems can generate them independently and never collide in practice, which is what makes them useful for distributed systems, database keys and correlation IDs.

How to use the UUID Generator

  1. Click Generate for a single UUID
  2. Use the bulk option to generate many at once
  3. Copy an individual value, or download the whole batch as a text file

Why collisions are not a practical concern

A version 4 UUID has 122 random bits, giving about 5.3 × 10³⁶ possible values. To reach a 50% chance of a single collision you would need to generate roughly 2.7 × 10¹⁸ of them — generating a billion per second, that is about 85 years.

The important caveat is that this only holds with a proper random source. This generator uses crypto.getRandomValues(), the browser's cryptographically secure RNG. UUIDs built from Math.random() — which some libraries still do — have far less real entropy and have caused collisions in production.

UUIDs as database keys

UUIDs let you generate an ID client-side before a row exists, which simplifies a great deal of distributed and offline-first work. The trade-offs are real though.

They are 16 bytes against 4 or 8 for an integer, which inflates every index that references them. More significantly, v4 UUIDs are random, so inserts land at random points in a B-tree index rather than appending at the end. On a large table that fragments the index and measurably hurts write throughput.

Where this matters, UUID v7 — which puts a timestamp in the high bits so values sort chronologically — gives you global uniqueness with sequential insert behaviour.

The UUID versions and which to pick

Several UUID versions exist and they are built for different problems.

Version 4 is 122 random bits and is what this tool produces. It needs no coordination, leaks nothing about where or when it was made, and is the right default for almost everything.

Version 1 encodes a timestamp and the generating machine's MAC address. It sorts roughly by creation time, which is useful, and it discloses hardware identity and creation time, which is usually not. It has been used to deanonymise documents.

Version 7 is the modern answer to the same need: a millisecond timestamp in the high bits followed by randomness. It sorts chronologically without revealing anything about the machine, and it is the version to reach for when database insert performance matters.

Versions 3 and 5 are deterministic — they hash a namespace and a name, so the same input always produces the same UUID. Useful for deriving a stable id from existing data rather than generating a new one.

If you want randomness, use v4. If you want randomness that sorts, use v7.

Storing UUIDs without wasting space

A UUID is 128 bits — 16 bytes. Written in the canonical form it is 36 characters, which stored as text is 36 bytes, or more in a variable-length column. That is more than double, and it compounds through every index and foreign key referencing it.

Where the database has a native UUID type — PostgreSQL's uuid, SQL Server's uniqueidentifier — use it. Storage is the full 16 bytes and comparisons are integer comparisons rather than string ones.

Where it does not, BINARY(16) is the efficient choice. MySQL's UUID_TO_BIN() and BIN_TO_UUID() handle the conversion, and UUID_TO_BIN(uuid, 1) additionally rearranges a v1 UUID so it sorts chronologically. Avoid CHAR(36) on a large table; the difference is substantial at scale.

The other cost is index locality. Random UUIDs scatter inserts across the whole B-tree, which fragments the index and hurts write throughput on big tables — the problem v7 exists to solve. For a table of modest size the simplicity of v4 is worth more than the locality.

Frequently asked questions

Are these UUIDs cryptographically secure?

Yes. They use crypto.getRandomValues(), the browser's CSPRNG — the same source used for cryptographic key material, not Math.random().

What does the 4 in version 4 mean?

The generation method. v4 is random; v1 is based on timestamp and MAC address; v5 is a hash of a namespace and name. The version is encoded in the 13th hex digit, which is always 4 here.

Can two UUIDs ever be the same?

Theoretically yes, practically no — with 122 random bits you would need to generate about 2.7 quintillion before a 50% chance of one collision.

Should I use UUIDs as primary keys?

They are excellent for distributed or offline-capable systems where IDs must be created before reaching the database. On very large, write-heavy tables consider UUID v7, which sorts chronologically and avoids index fragmentation.

Are generated UUIDs stored anywhere?

No. Generation is entirely local and nothing is recorded or transmitted.