UUID Generator

This UUID generator makes random version 4 UUIDs, or time-ordered version 7 UUIDs, using your browser’s secure random number generator. Choose how many you need and the format, then copy or download the list. Everything is created on your device, so nothing you generate is sent or logged.

Generate UUIDs

Version–
Bits–
Generated–

Check a UUID

Version–
Variant–
Embedded time–
Standard form–

Everything runs in your browser. Nothing you type is sent anywhere or logged.

How to use it

  1. Pick a version. Use version 4 for a general-purpose random ID. Use version 7 when the IDs will be database keys, because they sort by creation time.
  2. Choose how many UUIDs you need and the format your code or database expects. Standard lowercase with hyphens works almost everywhere.
  3. Press Copy all to paste the list, or Download .txt to save it. Tick the quotes and comma options to get a list ready for a code array or an SQL IN (…) clause.
  4. To inspect an ID you already have, paste it into Check a UUID. It accepts hyphens, braces, the URN form and the 32-digit form with no hyphens.

When to use it

  • Creating primary keys or record IDs for a database or an application.
  • Making time-ordered version 7 IDs that sort roughly by creation time.
  • Filling test data, fixtures and sample JSON with unique IDs in bulk.
  • Checking which version a UUID is and, for version 7, when it was created.

How a UUID is built

A UUID (universally unique identifier) is a 128-bit value, written as 32 hexadecimal digits in five groups, 8-4-4-4-12. Two small fields inside it say what kind it is. The first digit of the third group is the version. The first digit of the fourth group holds the variant, which for every modern UUID is 8, 9, a or b. The rest is data.

A version 4 UUID fills every other bit with random data, which leaves 122 random bits. A version 7 UUID starts with a 48-bit count of milliseconds since 1 January 1970 UTC, followed by 74 random bits. This tool takes all random bits from crypto.getRandomValues. When several version 7 UUIDs are made in the same millisecond, the random part counts up by one each time, so a batch always sorts in the order it was made.

Worked example. The sample version 4 UUID in RFC 9562 is 919108f7-52d1-4320-9bac-f847db4148a8. The third group starts with 4, so it is version 4. The fourth group starts with 9, which is binary 1001, so the variant bits are 10, the standard variant.

The sample version 7 UUID is 017f22e2-79b0-7cc3-98c4-dc0c0c07398f. The first 12 digits, 017f22e279b0, are 1,645,557,742,000 in decimal. That is milliseconds since 1970, which is 22 February 2022, 19:22:22 UTC. Paste it into the checker above to see the same result.

Will two UUIDs ever collide?

A collision is possible in theory but, for random UUIDs, absurdly unlikely. A version 4 UUID has 2122 possible values, about 5.3 × 1036. By the birthday-problem calculation, you would need to make about 2.7 × 1018 of them for even a 50% chance that any two match, and about 1014 (a hundred trillion) for a one-in-a-billion chance. This holds only when the random numbers come from a proper cryptographic source, as they do here.

UUID versions defined in RFC 9562
VersionWhat it containsTypical use
1Gregorian timestamp and a node IDOlder systems that need time-based IDs
3MD5 hash of a namespace and a nameThe same name always gives the same ID (older)
4122 random bitsGeneral-purpose unique IDs
5SHA-1 hash of a namespace and a nameThe same name always gives the same ID
6Version 1 time, reordered to sort by timeTime-sortable IDs when moving from version 1
7Unix millisecond timestamp and 74 random bitsDatabase keys that sort by creation time
8Custom data defined by the applicationVendor-specific schemes

Which format should I use?

  • Standard lowercase with hyphens is the canonical text form and works in nearly every language and database.
  • Uppercase and braces are common in Microsoft tools and the Windows registry, where a UUID is usually called a GUID.
  • No hyphens gives a 32-character string, often used in file names, URLs and some key-value stores.
  • URN form (urn:uuid:…) is for places that need the identifier written as a URN.

UUIDs are identifiers, not secrets

Use UUIDs to name things, not to protect them. A version 7 UUID shows when it was made. Even a version 4 UUID may be logged, shared in URLs and kept in places where secrets do not belong. For access tokens, passwords or API keys, make a longer random value with a tool designed for that purpose, such as our password generator.

Frequently asked questions

What is a UUID?

A UUID is a 128-bit identifier written as 32 hexadecimal digits in the pattern 8-4-4-4-12. It is designed so that IDs can be created anywhere, without a central counter, and still be unique in practice.

Is a UUID the same as a GUID?

Yes in practice. GUID is Microsoft’s name for the same 128-bit format. GUIDs are often shown in uppercase or inside braces, which you can choose here.

Should I use UUID version 4 or version 7?

Use version 4 when you want an ID that reveals nothing. Use version 7 for database primary keys, because new IDs sort after older ones, which keeps indexes tidy. The cost is that a version 7 UUID shows its creation time.

Can two UUIDs be the same?

It is possible but extremely unlikely. You would need to generate billions of billions of version 4 UUIDs before a duplicate becomes likely. If uniqueness is critical, such as a primary key, the database should still enforce it.

Is a UUID safe to use as a password or token?

It is not recommended. A UUID is built to be an identifier, so software often logs it, shows it in URLs or makes it with weaker random sources. Use a purpose-built random token for secrets.

Are the UUIDs I generate stored or sent anywhere?

No. They are created in your browser and disappear when you close the page. Nothing is uploaded or logged.

Sources and further reading