Skip to main content

UUID Generator

Generate version 4 UUIDs in your browser using crypto.randomUUID. Produce one or many at a time and copy them individually or all at once.

Produce version 4 UUIDs using crypto.randomUUID, the browser's standard implementation backed by a cryptographically secure random source. Generate a single identifier or a batch, and copy them one at a time or the whole list at once.

UUID Generator
30c41aa0-c04b-4088-92c7-fbdc8dbca2ad

Version 4 (random) · uses crypto.randomUUID()

// UUID Generator: Features

What a version 4 UUID is

A UUID is a 128-bit value written as thirty-two hexadecimal digits in five hyphen-separated groups. Version 4 means the value is random apart from six bits that identify the version and variant, leaving 122 random bits. That is the variant you want in almost every case: it needs no coordination, no central authority and no knowledge of the machine generating it, which is what makes it safe to generate identifiers independently in different services and still expect them to be unique.

Collisions are not a practical concern

With 122 random bits there are roughly 5.3 undecillion possible values. Generating a billion UUIDs per second for a century leaves the probability of a single collision negligible. The number is large enough that the realistic failure mode is not a collision but a bad random source, which is why using the platform's cryptographic generator rather than a hand-rolled one matters.

Where it comes from

Generation uses crypto.randomUUID, a standard browser API that draws on the same cryptographically secure random source used for key material. This is deliberately not Math.random, whose output is predictable from previous values. That predictability rarely matters for a database key, but it matters a great deal if the identifier ends up in a URL that acts as an unguessable capability, such as a share link.

UUIDs as database keys

The trade-off is well documented. A UUID primary key removes the need for a central sequence, lets a client generate an identifier before the row exists, and avoids leaking how many records you have. The cost is that random values scatter inserts across a B-tree index rather than appending to the end, which fragments the index and hurts write performance at scale. Version 7, which puts a timestamp in the high bits, exists to solve exactly that, and is worth knowing about if you are choosing keys for a large table.

Nothing is stored, which matters when a UUID is a secret

Everything happens in the page. The identifiers are not transmitted, stored or logged, and there is no history: reloading discards them. That is worth knowing when a UUID is being used as a secret, such as an unguessable link, because the value exists only where you put it.

// UUID Generator: FAQ

Which UUID version does this generate?

Version 4, the random variant, produced by crypto.randomUUID. It is the right default for identifiers you want to be unique without coordinating with anything else, and the version most libraries produce by default.

How likely is a collision?

Negligible for any realistic workload. With 122 random bits, you would need to generate on the order of a quintillion UUIDs before a collision became reasonably likely. In practice, a broken random source is a far more plausible failure than the mathematics running out.

Are these cryptographically secure?

The random source is, because crypto.randomUUID draws on the platform's cryptographic generator. That said, a UUID is an identifier, not a secret by design. If you rely on one being unguessable, for example as a share link, that works because of the randomness, but consider whether an explicit token with an expiry would express the intent better.

What is the difference between a UUID and a GUID?

Nothing meaningful. GUID is the name Microsoft uses for the same 128-bit identifier, and the two terms are interchangeable in practice. You may see GUIDs written in upper case or wrapped in braces, which is a formatting convention rather than a different format.

Should I use a UUID as a primary key?

It depends on scale. UUIDs let any service mint an identifier without coordination and avoid leaking row counts, which is genuinely useful. Against that, random values scatter index inserts and fragment B-trees, which becomes measurable on large, write-heavy tables. If that is your situation, look at version 7, which is time-ordered and keeps inserts sequential.

Can I generate several at once?

Yes. Set the count and generate a batch, then copy them individually or take the whole list with copy all. This is the usual way to seed test data or to set up several records by hand.

Why are some characters in the UUID always the same?

Because six bits are reserved. The thirteenth hexadecimal digit is always 4, identifying the version, and the seventeenth is always 8, 9, a or b, identifying the variant. Everything else is random. A value without those markers is not a conforming version 4 UUID.

Is the case significant?

No. UUIDs are case-insensitive, and the specification recommends producing them in lower case, which is what this tool does. Compare them case-insensitively if you are accepting them from elsewhere, since some systems emit upper case.

Are the generated UUIDs stored anywhere?

No. They exist only in the page, are never transmitted or logged, and are discarded when you reload or close the tab. Copy anything you need before navigating away.

Can I generate UUIDs offline?

Yes, once the page has loaded. Generation uses only browser APIs, so it continues to work without a network connection.

// How to Use UUID Generator

  1. Choose how many you need

    Set the count to one for a single identifier, or to a larger number to produce a batch for seeding test data or setting up several records.

  2. Generate

    Press generate to produce the identifiers. Each one is a fresh version 4 UUID from the browser cryptographic random source.

  3. Copy the identifiers

    Copy an individual UUID with the button beside it, or take the whole list with copy all. Nothing is kept once you reload, so copy before navigating away.

Category Utilities