UUID Generator

Generate version 4 or version 7 UUIDs in your browser, one at a time or a hundred at once.

Runs entirely in your browser. Nothing is uploaded, logged or stored.

Version

A UUID is a 128 bit identifier you can generate anywhere, without asking a central authority, and still expect to be unique. Two versions are offered here because they solve different problems.

How it works

Version 4 is 122 random bits, with six bits fixed to mark the version and the variant. It carries no information at all, which is exactly what you want for a public identifier and exactly what makes it a poor clustered primary key: consecutive inserts land in unrelated places in the index.

Version 7, standardised in RFC 9562, puts a 48 bit millisecond timestamp in front of 74 random bits. Values generated later sort after values generated earlier, so inserts stay at the end of the index and range queries by time work. The trade is that the identifier reveals when it was created.

The random bits come from your browser's cryptographic random number generator, the same source used for keys, not from Math.random.

Frequently asked questions

Should I use v4 or v7?

v7 for a database primary key, where ordering keeps the index healthy. v4 when the identifier is exposed and must not leak a creation time, or when ordering would let someone infer how many records you create per hour.

Can two UUIDs collide?

In principle yes, in practice no for v4: with 122 random bits you would need to generate billions per second for a century before a collision became likely. The real risk is a weak random source, which is why this uses the cryptographic one.

What about v1?

Version 1 embeds the MAC address of the machine that generated it, which leaks hardware identity. v7 gives you the same time ordering without that, and is the modern replacement.

Good to know

  • Values are generated in your browser and never sent anywhere.
  • This tool is not deterministic: reloading the page gives new identifiers, which is the point.

Sources

All Code tools