Skip to content
PC Moment

Free tool

UUID Generator (Version 4 and Version 7)

Generate up to 1,000 random version 4 or time-ordered version 7 UUIDs, and check the version, variant and timestamp of any UUID you paste.

Version

A UUID generator gives you identifiers that are unique without a central database handing them out, which is why they’re used for record IDs, file names and message IDs. This one creates up to 1,000 UUIDs at once, either random version 4 or time-ordered version 7 as defined in RFC 9562, in the format your code expects. Paste any UUID into the checker to see whether it’s valid, which version and variant it is, and, for version 7, when it was created.

How to use the UUID generator

  1. Choose the version: v4 random or v7 time-ordered.
  2. Enter How many UUIDs you want, from 1 to 1,000.
  3. Tick any formatting options: Uppercase, No hyphens or Wrap in braces {}.
  4. Select Generate. The UUIDs appear one per line.
  5. Use Copy all to put the whole list on your clipboard, or Download .txt to save it as a text file.
  6. To check a UUID, paste it into Check a UUID. The result says whether it’s valid and shows its variant and version, plus the embedded creation time for version 7, as a UTC date and in your local time.

How are UUIDs generated?

Version 4 UUIDs come from your browser’s crypto.randomUUID() and are random apart from 6 fixed bits. Version 7 UUIDs start with a 48-bit Unix timestamp in milliseconds followed by random bits, so they sort by creation time.

A UUID is 128 bits, written as 32 hex digits in five groups: 8-4-4-4-12. Two parts of it are fixed by RFC 9562, and you can read them straight from the text:

xxxxxxxx-xxxx-Vxxx-Nxxx-xxxxxxxxxxxx
  • V, the first digit of the third group, is the version (bits 48 to 51): 4 for random, 7 for Unix-time-ordered.
  • N, the first digit of the fourth group, holds the variant (bits 64 and 65). For the standard RFC variant those bits are 10, so N is always 8, 9, a or b.

RFC 9562 allows the hex digits in uppercase or lowercase and says input may use either. RFC 9562 also notes that some implementations wrap the hyphenated form in curly braces. Wrap in braces {} produces that form, and No hyphens gives the bare 32 digits.

Version 4: random

Version 4 UUIDs come from your browser’s crypto.randomUUID(), which MDN describes as generating a v4 UUID with a cryptographically secure random number generator. Apart from the 4 version bits and 2 variant bits, all 122 remaining bits are random. A version 4 UUID tells you nothing about when or where it was made.

Version 7: time-ordered

Version 7 puts the time first. RFC 9562 defines its layout as:

FieldBitsContents
unix_ts_ms48Unix timestamp in milliseconds, big-endian
ver4Version, 0111 (7)
rand_a12Random bits
var2Variant, 10
rand_b62Random bits

Because the timestamp fills the first 12 hex digits, version 7 UUIDs sort roughly by creation time even as plain text. A 48-bit count of milliseconds runs out about 8,900 years after 1970, in the year 10889.

How likely is a collision?

Very unlikely, but not impossible. RFC 9562 says UUIDs “feature sufficient entropy to ensure that the chances of collision are low”. A version 4 UUID has 2^122 possible values, about 5.3 × 10^36. A version 7 UUID can only clash with another made in the same millisecond, and then all 74 random bits would have to match as well. Even so, keep a unique constraint on any database column that stores them.

Important: A UUID is an identifier, not a secret. RFC 9562 says implementations should not assume UUIDs are hard to guess and that they “MUST NOT be used as security capabilities”. Don’t use one as a password-reset link, API key or session token on its own.

Version 4 or version 7 for database keys?

Database indexes work best when new keys land close to each other. RFC 9562 notes that non-time-ordered UUIDs such as version 4 have poor database-index locality, while time-ordered ones benefit from better locality, and it recommends version 7 over the older time-based versions 1 and 6. In short:

  • Choose version 7 for primary keys and anything you want to sort by creation time.
  • Choose version 4 when the ID shouldn’t reveal when it was created. Anyone can read a version 7 UUID’s timestamp, as the checker shows, and RFC 9562 advises version 4 where unguessability matters.

Worked examples

Identify a version 4 UUID. RFC 9562’s example 919108f7-52d1-4320-9bac-f847db4148a8 has 4 as the first digit of its third group (4320), so it is version 4. The fourth group starts with 9, which is the standard variant.

Read the time in a version 7 UUID. RFC 9562’s example 017F22E2-79B0-7CC3-98C4-DC0C0C07398F starts with 017F22E279B0. In decimal that is 1,645,557,742,000 milliseconds since January 1, 1970, which is February 22, 2022, 19:22:22 UTC (2:22:22 PM in US Eastern time). The third group starts with 7, the fourth with 9. Pasted into the checker, it shows as a valid version 7 UUID of the RFC variant, created 2022-02-22T19:22:22Z.

The same UUID in each format. Starting from 017f22e2-79b0-7cc3-98c4-dc0c0c07398f:

OptionResult
None017f22e2-79b0-7cc3-98c4-dc0c0c07398f
Uppercase017F22E2-79B0-7CC3-98C4-DC0C0C07398F
No hyphens017f22e279b07cc398c4dc0c0c07398f
Wrap in braces {}{017f22e2-79b0-7cc3-98c4-dc0c0c07398f}
All three{017F22E279B07CC398C4DC0C0C07398F}

An older version 1 UUID. The RFC’s URN example urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6 has 1 at the start of the third group and a at the start of the fourth: a version 1 (time-based) UUID of the standard variant. Version 1 includes a node ID that was traditionally the computer’s network MAC address, which RFC 9562 flags as a privacy concern.

The Nil UUID. 00000000-0000-0000-0000-000000000000, all 128 bits set to zero, is a special value defined by RFC 9562. The checker reports it as valid and names it the Nil UUID.

Frequently asked questions

Can two UUIDs ever be the same?

In theory yes, in practice it's extremely unlikely. A version 4 UUID has 122 random bits, and RFC 9562 says UUIDs have enough entropy to keep the chance of a collision low. It isn't zero, so a database should still enforce a unique key.

Should I use version 4 or version 7 for database keys?

Version 7 is usually the better choice for primary keys. Its timestamp comes first, so new IDs sort after older ones and land near each other in an index; RFC 9562 notes that random version 4 UUIDs have poor database-index locality. Use version 4 when the ID must not reveal when it was created.

Are UUIDs secret or hard to guess?

Don't rely on it. RFC 9562 says implementations should not assume UUIDs are hard to guess and that they must not be used as security capabilities. Use a proper access token or session key for that.

What is the difference between a UUID and a GUID?

They are the same thing. RFC 9562 describes UUIDs as also known as GUIDs (Globally Unique IDentifiers). If a system expects the GUID in uppercase or inside curly braces, tick Uppercase or Wrap in braces {}.

How can I tell which version a UUID is?

Look at the first digit of the third group: in 919108f7-52d1-4320-9bac-f847db4148a8 it is 4, so it's a version 4 UUID. The checker below the generator reads the version and variant for you.

Can I get the creation time from a UUID?

From a version 7 UUID, yes: the first 12 hex digits are a Unix timestamp in milliseconds, and the checker shows it as a date. A version 4 UUID contains no time at all.

Related guides

Free Developer and PC Tools

Free formatters, decoders and converters for developers and PC users. Everything runs in your browser, and nothing you type is sent anywhere.

3 min read