Skip to contentSkip to the inputSkip to the result

UUID generator

Create random (v4) or time-ordered (v7) identifiers.

Loading tool

Instructions

UUID generator

How to use

  1. Choose a quantity, version and style, then generate.
  2. Copy or download the list.

Supported input

  • Web Crypto randomness.
  • Version 7 identifiers sort in the order they were made.
  • Paste a UUID to see its version and creation time.

Input example

Quantity 2

Result example

Two RFC 9562 UUID strings

Troubleshooting

  • Check required inputs, numeric ranges and the selected conversion direction.

How it works

  • Create random (v4) or time-ordered (v7) identifiers.

Reading a UUID: the version digit, the timestamp in v7 and the real odds of a clash

Where people reach for one

  • Choosing a primary key in the app or on one of several servers before the row reaches the database, with no central counter to ask
  • An idempotency key, so a retried payment or order request is recognised as the same request
  • A correlation ID that follows one request through the logs of several services
  • A storage name for uploaded files, so two uploads called invoice.pdf do not overwrite each other

Two characters tell you what kind it is

A UUID is 128 bits written as 32 hex digits in groups of 8-4-4-4-12. The first digit of the third group is the version. The first digit of the fourth group carries the variant: for the RFC 9562 layout its top two bits are 10, so that digit is always 8, 9, a or b.

Take a v4 this tool produced: 1b8a55ec-84db-4c05-8a0b-cb90ca2f5dad. The 4 in 4c05 is the version and the 8 in 8a0b is the variant mark. Four version bits and two variant bits are fixed, which leaves 122 random ones. The check box accepts a value in braces, one with a urn:uuid: prefix or 32 digits without hyphens, and it names the all-zero nil UUID and the all-f max UUID rather than reporting a version for them.

The RFC’s own test values, decoded

  1. 1Paste the v7 example from the RFC 9562 appendix, 017F22E2-79B0-7CC3-98C4-DC0C0C07398F. The tool reports version 7, RFC 9562 variant.
  2. 2The first 12 digits, 017F22E279B0, are 1,645,557,742,000 in decimal: milliseconds since 1970, which is 22 February 2022, 19:22:22 UTC.
  3. 3The appendix’s v1 example, C232AB00-9414-11EC-B3C8-9F6BDECED846, comes out at the same instant. Version 1 counts 100-nanosecond steps from 15 October 1582 and stores its time fields low part first, so the tool reassembles them before converting.
  4. 4The v7 time field is 48 bits wide, enough until the year 10889, and because it comes first, sorting v7 values as plain text puts them in creation order.

Order inside a single millisecond

A batch of 1,000 v7 values made here fell into just five distinct milliseconds, yet all 1,000 lines were already in ascending order. The 74 bits after the timestamp work as a counter: within the same millisecond the next value adds 1 plus a random 16-bit number, and a new millisecond starts again from fresh random bits with the top one cleared so there is room to count. RFC 9562 section 6.2 calls this Monotonic Random (method 2).

Two consecutive values from one run show it: 01a16e1b-1beb-73b4-aae8-92531c225334 and 01a16e1b-1beb-73b4-aae8-92531c225a04 share the timestamp and differ only at the end. The guarantee covers values made on this page. A v7 created on another machine in the same millisecond is ordered against yours only to the millisecond.

Choosing between v4 and v7

  • Index performance. RFC 9562 notes that values which are not time-ordered, like v4, land at random places in a B-tree index, and the cost can be dramatic. For the key of a table that grows all day, v7 is the better fit.
  • What the ID gives away. As decoded above, anyone holding a v7 can read when it was made. If the ID appears in public URLs, ask whether revealing a customer’s sign-up time is acceptable; if not, use v4 there.
  • Never a secret. Section 8 of the RFC says UUIDs MUST NOT be used as security capabilities, identifiers whose mere possession grants access. A password-reset link needs its own unguessable token.
  • Making them in the database. PostgreSQL 18 ships uuidv7() and uuid_extract_timestamp() as built-ins, so keys can be generated server side with the same layout.

Collision odds, worked out

For n values drawn from 122 random bits, the birthday approximation 1 − e^(−n²/2^123) gives the chance that any two match. A billion v4 IDs: about 9.4 × 10⁻²⁰. A trillion: about 9.4 × 10⁻¹⁴. The odds only reach one in two at roughly 2.7 × 10¹⁸ values. In practice duplicates come from people, not probability: a UUID copied out of a test fixture into a second record is far more likely than a random clash.

Checked

Frequently asked questions

What is the difference between UUID v4 and v7?

v4 has 122 random bits and no order. v7 puts the creation time in milliseconds in its first 48 bits, so values sort in the order they were made. Choose Time-ordered (v7) when sort order matters, as with database keys.

How many characters is a UUID?

36 including four hyphens, or 32 hex characters with No hyphens. Upper case is also available, and you can make 1–1,000 at a time. Paste a UUID into the check box to see its version and variant, and for v1 or v7 when it was made.

Can two UUIDs ever be the same?

With 2^122 possible v4 values a clash is extremely unlikely but not impossible, so keep a unique constraint in your database. Values are generated in the browser and not sent to a server.