Skip to content
LocalOnly

UUID Generator

Stable

Generate cryptographically random v4 and time-ordered v7 UUIDs in bulk.

Everything is processed locally in your browser

About UUID Generator

This online UUID generator creates universally unique identifiers on demand - classic random version 4 UUIDs or modern, time-ordered version 7 UUIDs that sort naturally by creation time. Generate a single random UUID or thousands at once, then copy them individually or as a newline-delimited list. Everything is generated locally using the browser's cryptographic random source.

Features

  • Generate UUID version 4 (random) and version 7 (time-ordered, sortable)
  • Bulk mode: create up to thousands of unique IDs in a single click
  • Cryptographically secure randomness via crypto.getRandomValues
  • Toggle uppercase, hyphenless, and braced { } output formats
  • Copy a single UUID or the entire list as newline-separated text
  • Instant regeneration with no rate limits, accounts, or network calls

How to use UUID Generator

  1. 1

    Pick a UUID version

    Choose v4 for general-purpose random identifiers, or v7 when you want IDs that sort by creation time - ideal for database primary keys.

  2. 2

    Set how many you need

    Generate one ID or enter a count for bulk output. IDs appear instantly as you change the amount.

  3. 3

    Adjust the format (optional)

    Switch to uppercase, remove hyphens, or wrap each value in braces to match your platform's conventions.

  4. 4

    Copy and use

    Copy a single value or the whole list, then paste it into your code, database, or config.

Examples

A random version 4 UUID

122 bits of secure randomness with the version and variant bits fixed.

Input

Version: v4 · Count: 1

Output

f47ac10b-58cc-4372-a567-0e02b2c3d479

A time-ordered version 7 UUID

The leading segments encode a Unix millisecond timestamp, so values sort chronologically.

Input

Version: v7 · Count: 1

Output

017f22e2-79b0-7cc3-98c4-dc0c0c07398f

How UUIDs work

The versions solve different problems

A UUID is 128 bits written as 36 characters, and the version digit tells you how those bits were chosen. Version 4 is 122 random bits and is the default for almost everything - it needs no coordination, leaks nothing about where it was made, and collisions are not a practical concern. Version 7, standardised in RFC 9562 in 2024, puts a 48-bit Unix millisecond timestamp in the high bits followed by randomness, so identifiers sort chronologically while remaining unguessable.

That sortability is the reason v7 exists and it matters more than it sounds. Database indexes on random keys suffer because every insert lands at a random point in the B-tree, scattering writes across pages and fragmenting the index. Time-ordered keys append at the end, keeping inserts sequential and the index compact. On a high-write table the difference is substantial, which is why v7 has quickly become the recommendation for new primary keys.

Versions 1 and 6 are also time-based but include the machine's MAC address, which leaks hardware identity - a real privacy consideration and the reason v1 fell out of favour. Versions 3 and 5 are deterministic: they hash a namespace and a name, so the same input always yields the same UUID. That is useful for deriving stable identifiers from existing keys, with v5 preferred since it uses SHA-1 rather than MD5.

How unlikely a collision really is

Version 4 has 122 random bits, giving about 5.3 × 10^36 possible values. The birthday bound says you would need to generate roughly 2.7 × 10^18 UUIDs before reaching a 50% chance of a single collision. At a billion per second, that is around 85 years.

For a sense of scale at realistic volumes: generating a billion v4 UUIDs gives a collision probability of about one in 10^19. You are far more likely to lose the data to simultaneous hardware failure than to a duplicate identifier.

The important caveat is that this holds only with a cryptographically secure random source. `Math.random()` is not one - it is seeded from limited entropy and its output is predictable, so UUIDs built on it can both collide and be guessed. Browsers expose `crypto.getRandomValues()` and `crypto.randomUUID()` for exactly this reason, and any generator worth using calls one of them.

Using UUIDs as database keys

The advantages are real. A client can generate an identifier before talking to the server, so optimistic UI updates and offline-first workflows work without round trips. Merging data from several systems cannot collide. And because the keys are not sequential, they do not leak how many records you have or let anyone enumerate them - a sequential `/orders/1234` invites someone to try `1235`.

The costs are equally real. A UUID stored as text takes 36 bytes against 4 or 8 for an integer, and that cost is paid in every index and every foreign key. Storing it as a native 16-byte binary type - `uuid` in PostgreSQL, `BINARY(16)` in MySQL - recovers most of that. Random v4 keys also fragment indexes, which is the problem v7 was designed to solve.

The practical recommendation for a new system is v7 in a native UUID column: you get the coordination-free generation and non-enumerability of a UUID, with insert behaviour close to a sequential key.

Reference

UUID versions

VersionBuilt fromSortableUse for
v1Timestamp + MAC addressPartlyLegacy; leaks hardware identity
v3MD5 of namespace + nameNoDeterministic ids; prefer v5
v4122 random bitsNoThe general-purpose default
v5SHA-1 of namespace + nameNoStable ids derived from a known key
v6Reordered v1 timestampYesMigrating v1 data to sortable form
v7Unix ms + randomnessYesNew database primary keys

Which tool should you use?

These tasks overlap. Here is how to pick the right one for what you are actually doing.

You need a database primary key for a new table
Version 7. Chronological ordering keeps index inserts sequential, which random v4 keys do not.
You need a general-purpose unique identifier
Version 4. It is the well-understood default and needs no coordination.
You want a shorter identifier for a URL
The Nano ID Generator produces 21 characters with comparable collision resistance.
You need the same input to always produce the same id
Version 5, which hashes a namespace and a name deterministically.
You need a secret, not an identifier
Use the Password Generator. UUIDs appear in logs and URLs and are not designed to be confidential.

Use cases

  • Primary keys and foreign keys for database records
  • Idempotency keys and request IDs for APIs and message queues
  • Correlation IDs for distributed tracing and structured logging
  • Unique filenames, session tokens, and cache keys
  • Seeding test fixtures and mock data with realistic identifiers
  • Stable React keys and DOM element IDs during prototyping

Troubleshooting common errors

Insert performance degraded after switching to UUID keys

Why: Random v4 values scatter index inserts across the B-tree, fragmenting pages.

Fix: Move to version 7 for time-ordered keys, and store them in a native 16-byte UUID column rather than as text.

Duplicate UUIDs appeared

Why: Effectively impossible with a secure random source, so the generator is almost certainly seeded from `Math.random()` or a fixed seed.

Fix: Use `crypto.randomUUID()` or a library built on `crypto.getRandomValues()`. Also check that your code is not reusing one generated value.

A UUID is rejected as invalid

Why: Usually formatting - braces, a missing hyphen, or uppercase hex where the validator expects lowercase.

Fix: Normalise to canonical lowercase 8-4-4-4-12 with no braces. RFC 9562 requires parsers to accept uppercase but many do not.

Someone guessed a UUID in a URL

Why: Not a v4 UUID, then. v1 embeds a timestamp and MAC address, and v7 embeds a timestamp - and any UUID from a weak random source is predictable.

Fix: Never rely on a UUID as an access control mechanism. Check authorisation server-side regardless of how unguessable the identifier looks.

Limitations

What this tool deliberately does not do, so you know when to reach for something else.

  • A UUID is an identifier, not a secret - it appears in logs, URLs and referrer headers.
  • Version 7 deliberately reveals its creation time, which is occasionally a privacy consideration.
  • 36 characters as text is significantly larger than an integer key; use a native binary column.
  • Version 4 UUIDs are not sortable, so they cannot double as a chronological ordering.
  • Uniqueness depends entirely on the quality of the random source.

Frequently asked questions

Learn more

Command Palette

Search for a tool or command