Tools
Guides

UUID Generator

Dev

Generate cryptographically random UUIDs (RFC 4122 v4) using crypto.randomUUID.

100% client-side No backend
On this page

What is a UUID?#

A UUID (Universally Unique Identifier, also called GUID on Microsoft systems) is a 128-bit identifier rendered as 32 hex digits grouped into 8-4-4-4-12, for example c9bf1d4d-7d4f-4b3a-8b2c-1e5f6a7b8c9d. The idea is simple but powerful: generate identifiers on demand, with no central authority and no coordination between machines, and still have the probability of two colliding be effectively zero. That property is what makes UUIDs the default primary-key strategy for distributed databases, the id field on almost every JSON API resource, the correlation IDs that tie log lines together across microservices, and the filenames of uploaded blobs.

This page generates RFC 4122 version 4 UUIDs — the variant built from random bits. Version 4 is what you want in almost every modern case: it carries no machine MAC address (unlike v1), embeds no namespace hierarchy (unlike v3/v5), and relies purely on cryptographic randomness for uniqueness. You can generate a single UUID or a batch of up to 10,000 at once, in lowercase or uppercase, entirely in your browser.

Two of the 32 hex digits are not actually random — they declare the UUID’s own type. The version nibble at position 14 (the first character of the third group) is always 4, and the variant nibble at position 19 (the first character of the fourth group) is always 8, 9, a, or b. That is why every value you see on this page reads xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx. Those two fixed positions double as a self-describing fingerprint: any string that matches this shape is a v4 UUID, and a quick regex can validate millions of them.

How to use it#

  1. Set the Count number field at the top to how many UUIDs you want — anywhere from 1 to 10,000. The field is clamped to that range.
  2. Tick Uppercase if you need all-uppercase output (some legacy systems and Microsoft GUID conventions prefer C9BF1D4D-…). Leave it unchecked for the lowercase default that most modern stacks use.
  3. Click Generate. The values appear in the monospace output area, one per line.
  4. Click Copy to copy the whole batch to your clipboard, ready to paste into a SQL INSERT, a CSV, a test fixture, or a seed script.
  5. Click Generate again any time you need a fresh batch — every click draws new random bits and produces values that have never existed before.

Key features#

  • Real cryptographic randomness. Uses the browser’s crypto.randomUUID() in secure contexts, with a crypto.getRandomValues fallback that applies rejection sampling on the version and variant bits — not Math.random(), which is not suitable for identifiers.
  • Batch generation. Up to 10,000 UUIDs in one click, one per line, so you can seed a database or fixture file without scripting it yourself.
  • Lowercase or uppercase. One toggle covers both conventions.
  • RFC 4122 v4 compliant. The version nibble is always 4 and the variant nibble is always 8/9/a/b, so every value validates against the standard v4 regex.
  • 100% client-side. No backend, no telemetry. The UUIDs you generate here are not recorded anywhere — they are yours the moment they appear.

Worked example#

Click Generate with Count left at its default of 5 and Uppercase unchecked, and you get five lines like this (your actual values will differ — they are random):

7f3a9c2e-1b4d-4e8f-a6c3-9d2b8e1f0a47
2c8d4f1a-9e3b-47a2-8c6d-1f5e9a0b3c28
a1b2c3d4-e5f6-4789-abcd-ef0123456789
9e8d7c6b-5a4f-3210-ba98-76543210fedc
4f3e2d1c-0b9a-8765-4321-fedcba987654

Look closely at the third group of any line: it always starts with 4. Look at the fourth group: it always starts with 8, 9, a, or b. Those two characters are not random — they are the version and variant markers, and they are the reason a one-line validator can confirm a string is a genuine v4 UUID.

If you tick Uppercase and generate again, the same shape comes out in capitals, e.g. 7F3A9C2E-1B4D-4E8F-A6C3-9D2B8E1F0A47 — identical bits, just rendered for systems that expect uppercase GUIDs.

FAQ#

How unique is a v4 UUID really? Will I ever get a duplicate?#

The numbers get absurd quickly. A single v4 UUID has 122 bits of actual randomness (128 minus the 4 version bits and 2 variant bits). To have even a 50% chance of one collision you would need to generate about 2.71 × 10^36 UUIDs — that is a billion billion billion per second for longer than the age of the universe. For any realistic database or system, you can treat collisions as impossible, and you do not need to check for them.

Is it safe to use these UUIDs as database primary keys?#

Yes — version 4 is the most common choice for that exactly because it needs no coordination. The one caveat is index fragmentation: purely random keys scatter across a B-tree, so on a very high-write PostgreSQL or MySQL table you may prefer a UUIDv7 (time-ordered) variant. For application-level resource IDs, correlation IDs, and most tables, plain v4 is fine.

Why not just use Math.random() to build a UUID?#

Because Math.random() is not cryptographically sound — its output can be predictable enough that an attacker who observes a few IDs can guess others. This tool deliberately uses crypto.randomUUID() (and a crypto.getRandomValues fallback with proper version/variant handling), which draws from the operating system’s CSPRNG. For anything that identifies a user, session, or resource, that distinction matters.

Can I generate version 1, version 5, or named UUIDs here?#

No — this page is intentionally v4 only, because v4 covers the overwhelming majority of real use cases and needs no inputs beyond a random source. If you need a name-based v5 UUID (deterministic from a name and a namespace), that is a different computation and belongs in your application code or a dedicated tool.