Search

Jump to a tool or a page

UUIDs, generated in bulk

Cryptographically secure version 4 UUIDs and GUIDs, formatted however you need them, generated entirely on your device.

Generated Keys (0)

Generation Controls

10
150100
Quotes wrapper
List separator

Understanding UUID v4

Unlike v1 (time-based) or v5 (namespace-hash) UUIDs, version 4 uses almost entirely random values, aside from six bits marking the version and variant. That means no predictable links between records, which is why it is the default choice for distributed databases, security tokens, and session keys.

Cryptographic randomness

This generator uses the browser's native crypto.randomUUID(), which draws from your operating system's entropy pool, far more robust than a plain Math.random() call.

Collision odds

The 128-bit structure yields roughly 340 undecillion possibilities. For practically any application, even at massive scale, duplicate identifiers never happen.

Understanding UUIDs

What the 128 bits actually contain, how the versions differ, why collisions are not worth worrying about but weak randomness is, and the indexing cost of using random identifiers as primary keys.

How a UUID is structured

A UUID is 128 bits, normally written as 32 hexadecimal characters in five hyphen-separated groups. The hyphens are purely presentational. The underlying value is the 128 bits, which is why databases can store one in 16 bytes rather than the 36 characters the text form occupies.

Two small fields inside those bits are reserved. Four bits identify the version, and two or three bits identify the variant. In the canonical text form the version is always the first character of the third group, which makes it readable at a glance.

f81d4fae-7dec-11d0-a765-00a0c91e6bf6
             ^
             version digit (1 here)

This is why a version 4 UUID always has a 4 in that position, and why the first character of the fourth group is restricted to 8, 9, a, or b. Those characters are not random; they carry the variant.

Which version to use

Several versions exist, and they solve genuinely different problems. Most applications need version 4 or version 7.

  • Version 4Random. 122 of the 128 bits come from a random source. This is the default choice when you simply need a unique identifier and have no other requirements.
  • Version 7A Unix timestamp in milliseconds followed by random bits. Sorts chronologically as text or as bytes, which makes it far kinder to database indexes than version 4.
  • Version 1Timestamp plus MAC address. Sortable, but it leaks the generating machine and the creation time. Largely superseded by version 7.
  • Versions 3 and 5Deterministic hashes of a namespace and a name, using MD5 and SHA-1 respectively. The same input always produces the same UUID, which is useful for deriving stable identifiers from existing keys.

This generator produces version 4 UUIDs, which is the right default for the large majority of uses.

Collisions are not a practical concern

A version 4 UUID has 122 random bits, giving roughly 5.3 undecillion possible values. The probability of a collision follows the birthday problem rather than simple division, so the intuition that "there are lots of them" understates the safety margin considerably.

To reach a one in a billion chance of a single duplicate, you would need to generate around 103 trillion UUIDs. At a million per second that takes over three years of continuous generation.

The realistic failure mode is not mathematical, it is a weak random source. A UUID generated from a poorly seeded pseudo-random generator can repeat readily, which is why generation should always use a cryptographic source. This tool uses the browser crypto API rather than Math.random for exactly that reason.

The database index problem

Using random UUIDs as primary keys has a well-documented cost. Most relational databases store rows in a B-tree ordered by primary key. Sequential integers append to the rightmost page, which stays in memory and fills neatly. Random UUIDs scatter inserts across the whole tree, so pages split constantly, cache hit rates fall, and the index grows larger than it needs to be.

The effect is invisible on small tables and pronounced on large, write-heavy ones. There are three common ways to avoid it.

  • Use version 7The timestamp prefix makes new values sort to the end, restoring the append-mostly behaviour that keeps a B-tree healthy.
  • Keep an internal integer keyUse a sequential primary key internally and expose the UUID as a separate indexed column for external references.
  • Store as binary, not textBINARY(16) rather than CHAR(36) more than halves the storage per key, and every index that includes the key shrinks with it.

A UUID is not a secret

Because version 4 UUIDs are unguessable, they are sometimes used as capability tokens: an unlisted URL containing a UUID that anyone holding the link can access. That works, but only while the link stays private, and links leak in predictable ways.

URLs appear in browser history, in Referer headers sent to third-party sites, in server access logs, in analytics tools, in chat previews that fetch the page, and in anything that syncs browser tabs between devices. None of those places is a secret store.

For anything that genuinely needs protecting, use an identifier alongside an access check rather than an identifier as the access check. UUIDs are excellent at being unique; they were never designed to be credentials.

Formatting and comparison

The canonical text form is lowercase, but uppercase is equally valid, and Microsoft tooling frequently wraps the value in braces. String comparison between systems that disagree on case will report two identical UUIDs as different.

Normalise on input rather than trusting the source. Strip braces, lowercase the string, and compare the 16 bytes rather than the text wherever the language makes that convenient. If you store UUIDs as text, apply the same normalisation before writing so the stored form is consistent.

Common questions

What is a UUID or GUID?

A Universally Unique Identifier (UUID), also called a GUID, is a 128-bit number used to identify data in computer systems. Standard UUIDs are formatted in five hyphen-separated groups (8-4-4-4-12), 36 characters total.

How secure is this UUID generator?

This tool is privacy-first. Generation happens entirely in your browser via the native Web Crypto API (crypto.randomUUID()). No generated IDs are ever transmitted to or stored by our servers.

What is the chance of a UUID collision?

For version 4 UUIDs, the collision probability is practically zero. With 122 bits of entropy, there are about 5.3 undecillion possible combinations, generating a billion UUIDs a second for 85 years would still give roughly a 50% chance of one collision.

What is the difference between uppercase and braces formatting?

Unix and web environments (JavaScript, Java) typically use lowercase, hyphenated UUIDs. Microsoft environments (Windows Registry, C# GUIDs) often use UPPERCASE wrapped in braces, like {550E8400-E29B-41D4-A716-446655440000}. This tool toggles between both instantly.

Related tools

Other free tools that tend to come up in the same work.