Programming tool

UUID Generator

Generate secure standard UUID v4 identifiers entirely in your browser.

UUID v4 output

How this generator produces each UUID

The generator first checks for crypto.randomUUID(), a built-in browser function that returns a ready-made version 4 UUID. Where that function isn't available, it falls back to crypto.getRandomValues() to fill 16 bytes with cryptographically secure random data, then manually sets two small groups of bits: the top nibble of byte 6 is forced to 0100 (marking the UUID as version 4) and the top two bits of byte 8 are forced to 10 (marking it as RFC 4122 variant). Neither path ever touches Math.random(), which is fast but not designed to resist prediction.

You can request 1 to 100 UUIDs per click, optionally render them in uppercase, and copy the whole batch to the clipboard in one action. Generation, formatting, and the copy operation all happen inside the browser tab — no UUID is sent anywhere before you see it.

Anatomy of a version 4 UUID

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

A UUID is 128 bits written as 32 hexadecimal digits grouped 8-4-4-4-12 with hyphens, for 36 characters total. Two of those groups are only partly random: the third group always starts with the digit 4, which is the fixed version marker, and the fourth group always starts with 8, 9, a, or b, which is the fixed variant marker. Strip out those 6 fixed bits and you're left with 122 bits of actual randomness — enough combinations that the number is normally written in scientific notation: 2^122 ≈ 5.32 × 10^36 possible values.

How real is the collision risk

A 'collision' means two separately generated UUIDs happening to match. With 122 random bits, the birthday-paradox math says you'd need to generate about 2.71 quintillion (2.71 × 10^18) version 4 UUIDs before the odds of even one accidental match reach 50%. To put that count in perspective: generating 1 billion UUIDs every second, nonstop, would take roughly 86 years (2.71 × 10^18 ÷ 1 × 10^9 seconds ÷ 31,557,600 seconds per year ≈ 85.9 years) to reach that 50% mark. No realistic application gets anywhere near that volume, which is why UUID v4 is trusted for distributed key generation without a central coordinator.

Where UUID v4 fits and where it doesn't

A UUID is an identifier, not a secret. It's built to be unique, not to be hard to guess in a security sense the way a session token or API key needs to be — although because this tool's randomness source is cryptographically secure, the values it produces are also unpredictable, they just aren't intended to carry authentication weight. Keep that distinction in mind when deciding whether an ID belongs in a database column or in an Authorization header.

Common uses for generated UUIDs

  • Primary keys for a distributed database, where multiple servers need to insert rows without asking each other for the next number
  • Correlation IDs attached to log lines so a single request can be traced across several microservices
  • Populating realistic-looking test fixtures or seed data for a staging database
  • Idempotency keys sent with an API request so a retried call doesn't get processed twice
  • Filenames for uploaded assets, avoiding collisions when many users upload files with the same original name
  • Anonymous device or session identifiers that don't need to double as a security credential

Frequently asked questions

Is a UUID the same thing as a secure auth token?

No. A UUID is designed to be unique, not secret. This generator's output happens to come from a cryptographically secure random source, but UUIDs are conventionally treated as identifiers that can appear in URLs and logs, not as passwords or session secrets.

Can two UUID v4 values ever actually collide?

Mathematically yes, but the odds are astronomically small: with 122 random bits (2^122 ≈ 5.32 × 10^36 possibilities), you'd need to generate about 2.71 quintillion UUIDs before there's a 50% chance of a single accidental match — equivalent to generating 1 billion per second for roughly 86 years straight.

Why does every UUID here have a 4 in the same spot?

That digit is the fixed version marker required by the UUID v4 specification, along with a fixed variant digit (8, 9, a, or b) later in the string. Together they use up 6 of the 128 bits, leaving 122 bits random.

Is this generator's randomness good enough for real use?

It uses crypto.randomUUID() when the browser provides it, and otherwise crypto.getRandomValues() — both are cryptographically secure pseudo-random number generator (CSPRNG) APIs. It never falls back to Math.random(), which is unsuitable for anything security-adjacent because its output can sometimes be predicted.

Does generating UUIDs here send anything to a server?

No. Every value is produced by the browser's own random-number facilities and stays in the page until you copy it — nothing is transmitted, logged, or stored remotely.

What's the difference between UUID v4 and versions like v1 or v7?

Version 1 encodes a timestamp and the generating machine's network address, which can leak information about when and where it was created. Version 7 is also time-ordered, which helps database index performance for sequential inserts. Version 4, generated here, uses no timestamp or machine data at all — it's just random bits plus the fixed version and variant markers.