How to Generate a UUID (and Which Version to Use)

By Daniel · Updated July 2026

A UUID (universally unique identifier) is a 128-bit value written as 36 characters like f47ac10b-58cc-4372-a567-0e02b2c3d479. Its whole point is that you can generate one anywhere, at any time, without a central authority, and be practically certain nobody else will ever generate the same one.

Which version do you want?

  • v4 — random. The default for almost everything: database keys, API tokens, file names. If you are unsure, use v4.
  • v7 — time-ordered. Like v4 but sortable by creation time, which keeps database indexes tidy. A great modern default if your tools support it.
  • v1 — based on time and a machine identifier. Mostly legacy; it can leak the timestamp and MAC address.

How to generate one

  1. Open the UUID generator.
  2. Pick the version (v4 is fine for most needs) and how many you want.
  3. Copy them out. They are generated on your device using the browser's secure random source.

When a UUID is the wrong tool

UUIDs are long and not human-friendly, so they make poor public-facing codes like order numbers or coupon codes — a short, readable code is better there. And because v4 is random, using it as a primary key can fragment a database index; that is exactly the problem v7 was designed to fix.

UUID Generator
Generate one or many UUIDs instantly, right in your browser.
Open the tool →

Common questions

Are two UUIDs ever the same?

In practice, no. A v4 UUID has 122 random bits; you would have to generate billions per second for many years before a collision became likely.

Which UUID version should I use?

v4 (random) is the safe default. Use v7 if you want IDs that also sort by time, which helps database performance.

Is a UUID secure enough to use as a password?

A v4 UUID is random, but it is not meant as a secret and some systems log it. For passwords or API keys, use a dedicated generator.

Are these generated privately?

Yes. They are created in your browser with no server involved.

Keep reading

How to Create a Strong Password · How to Generate a Hash · How to Decode a JWT