UUID Generator

Client-sideNo sign-upFree

Generate random UUID v4 identifiers, one or many at a time.

Quick facts

Category
Generators
Best for
Generating unique database keys or request IDs
Generated UUIDs (v4)
f008ab84-c850-4cb9-a9de-d8be0243a5aa 6c6ba63d-1b09-44ab-afcc-d9ebb143cf42 2b96e984-2ad5-48d8-936d-8a55fd9e3bde 8b85a55b-450f-4039-944b-b80ea5b291a2 c14b2c13-7400-4085-8432-b82471c17c90
5 generated
In-content slot
Was this tool helpful?

A UUID (universally unique identifier) is a 128-bit value designed so that two independently generated ids are, for all practical purposes, guaranteed not to collide - no coordination or central registry required. This guide covers the version 4 (random) format this tool generates and why collisions are effectively impossible.

On this page

Anatomy of a version 4 UUID

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
  • 32 hex digits total, grouped into 5 dash-separated sections (8-4-4-4-12), 128 bits of raw data.
  • The character shown as "4" is fixed - it marks this as version 4 (randomly generated), as opposed to version 1 (timestamp+MAC-based), 3/5 (name-based hashes), or 7 (timestamp-ordered, increasingly common for database keys).
  • The character shown as "y" is constrained to 8, 9, a, or b - this is the variant bits (RFC 4122), which take up 2 of that character's 4 bits, leaving 2 random bits there.
  • Every other "x" is a fully random hex digit (4 random bits each).

Out of 128 total bits, 6 are fixed (4 for the version nibble, 2 for the variant bits), leaving 122 bits of actual randomness - roughly 5.3 x 10^36 possible values.

Why collisions are effectively impossible

The relevant question isn't "could two random UUIDs ever be equal" (mathematically, yes, with vanishing probability) but "how many would I have to generate before a collision becomes likely" - this is the classic birthday-problem calculation.

p ~ 1 - e^(-n^2 / (2N))
n
number of UUIDs generated
N
total possible values = 2^122 (the random bits in a v4 UUID)
p
approximate probability that at least two of the n UUIDs collide

Collision probability after generating 1 billion UUIDs

  1. n = 1,000,000,000 (10^9), so n^2 = 10^18
  2. N = 2^122 ~ 5.3169 x 10^36, so 2N ~ 1.0634 x 10^37
  3. n^2 / (2N) = 10^18 / 1.0634 x 10^37 ~ 9.4 x 10^-20
  4. p ~ 1 - e^(-9.4x10^-20), which for such a tiny exponent is essentially equal to 9.4 x 10^-20 itself
  5. Result: after generating one billion v4 UUIDs, the chance any two of them match is roughly 1 in 10^19 - vastly smaller than, for comparison, the odds of a specific person being struck by lightning this year (roughly 1 in a million).
This calculation assumes a cryptographically sound random source, which is what this tool and modern language UUID libraries use (crypto.getRandomValues in the browser). A UUID generated from a weak or predictable random source loses these guarantees regardless of the version number.

When to use v4 vs. other UUID versions

VersionBased onGood for
v4Pure randomnessGeneral-purpose ids with no ordering requirement - the most common choice
v1Timestamp + MAC addressLegacy systems that need rough time-ordering; leaks host MAC and generation time
v5SHA-1 hash of a namespace + nameDeterministic ids - the same input always produces the same UUID
v7Unix timestamp (ms) + random bitsDatabase primary keys - sorts naturally by creation time while staying random enough to avoid guessing

Frequently asked questions

A UUID (Universally Unique Identifier) is a 128-bit value used to uniquely identify information without requiring a central authority, commonly used as database primary keys.

UUID v4 values are generated using random or pseudo-random numbers. The chance of a collision is astronomically small - practically negligible for real-world use.

Explore more free tools

Formatters, converters, validators, and generators - all free and running entirely in your browser.

Browse more tools