UUID Generator

Generate random v4 or time-ordered v7 UUIDs (GUIDs) instantly, or v1, v6 and name-based v3/v5 in bulk. Validate and decode any UUID. Runs in your browser.

Your UUID

v4 · random

Bulk UUID generator

Up to 10,000 at once
Version

UUID validator & decoder

Version, variant, timestamp, node
Try:

UUID collision probability calculator

Accepts 1000000, 1e9, 10^12 or “5 billion”.

Chance of at least one duplicate

…

Why use this UUID generator?

One random v4 is often all you need, and it's waiting at the top of the page. Beyond that, this generator covers every version in RFC 9562 that can be generated safely in a browser: v4 and v7 for new work, v1 and v6 for older systems, and name-based v3 and v5 from any namespace. It formats them the way your code wants them (upper case, no hyphens, braces, quotes, JSON or CSV), and its decoder explains any UUID you paste, including the time hidden in v1, v6 and v7 IDs. Randomness comes from crypto.getRandomValues, and nothing leaves your device.

How it works

  1. For one UUID, copy the v4 shown at the top, or press New v7 for a time-ordered one.
  2. For many, pick a version in the bulk generator, set the quantity (up to 10,000) and choose the case, wrapping and output format. Changing a format re-renders the same batch.
  3. For v3 or v5, choose a namespace (DNS, URL, OID, X.500 or your own UUID) and type one name per line: each line becomes one UUID, and the same name always gives the same result.
  4. Copy everything at once or download it as a .txt, .json or .csv file. Paste any UUID into the decoder to check it and read its fields.

UUID versions compared

RFC 9562, published in May 2024, replaced RFC 4122 and defines eight versions. The version is the 13th hex digit. Which one to use depends on two questions: should the IDs sort by creation time, and should the same input always give the same ID?

UUID versions and what they contain
VersionWhat's insideSorts by timeSame input, same IDGood for
v1Gregorian time (100 ns), clock sequence, node (often a MAC address)Not as textNoLegacy systems; leaks the time and possibly the machine
v3MD5 hash of a namespace and a nameNoYesStable IDs from existing names, where v5 isn't available
v4122 random bitsNoNoGeneral purpose; IDs that must reveal nothing
v5SHA-1 hash of a namespace and a nameNoYesStable IDs from URLs, domains, emails or file paths
v6v1's fields reordered, most significant time firstYesNoUpgrading v1 systems to sortable IDs
v748-bit Unix time in ms, then 74 random or counter bitsYesNoDatabase primary keys, event and log IDs
v8Anything; only the version and variant are fixedDependsDependsCustom layouts specific to one system
NilAll 128 bits zeron/an/a“No UUID”, like null
MaxAll 128 bits onen/an/aAn upper sentinel in ranges

Version 2 (DCE Security) also exists but is almost never used, and RFC 9562 leaves its details to the old DCE specification, so this page decodes it but doesn't generate it. v8 is a container for vendor-defined layouts, so there is nothing generic to generate either.

UUID v4 or v7 for database primary keys?

Most databases store a primary key in a B-tree index, which keeps keys in sorted order. Random v4 keys land on a random page of that index for every insert, so a busy table touches pages all over the index, splits half-full pages and needs much more of the index in memory. A v7 key starts with the current time in milliseconds, so new rows go to the end of the index, much like an auto-increment integer, while keeping the advantages of a UUID: IDs can be made on any server or client without a round trip, and they don't reveal how many rows exist.

The cost is that a v7 shows when it was made. Anyone holding the ID can read the creation time to the millisecond, as the decoder above shows. That is harmless for internal row IDs but can matter in public URLs (an account ID that reveals the sign-up date) or anywhere the timing of records is sensitive. In those places use v4, or keep a v7 internally and expose a separate random ID.

  • PostgreSQL: use the native uuid type (16 bytes). gen_random_uuid() makes v4, and PostgreSQL 18 added uuidv7().
  • MySQL: store BINARY(16) rather than CHAR(36); a text key is more than twice the size, and so is every index that repeats it.
  • SQL Server: UNIQUEIDENTIFIER sorts by its last six bytes first, so a v7's time order doesn't carry over to its index order there. Check how your database compares UUIDs before choosing v7 for ordering.

How to read a UUID

Every UUID has the same 8-4-4-4-12 shape. Two positions are fixed for all standard UUIDs: the 13th digit is the version and the 17th digit is the variant, which is 8, 9, a or b for RFC 9562 UUIDs. Here is a v7 UUID generated for 2025-06-01T09:30:00.000Z, split into its parts:

01972ad3-99c0-7d3a-8f00-1e2d3c4b5a69
  • 01972ad399c0 (first 12 digits): the Unix time in milliseconds, in hex. 0x01972ad399c0 is 1,748,770,200,000 ms after 1 January 1970, which is 2025-06-01T09:30:00.000Z. The timestamp converter turns milliseconds like these into a date.
  • 7: the version digit.
  • d3a: 12 bits that are either random or, as in this generator, a counter that keeps UUIDs made in the same millisecond in order.
  • 8: the variant digit; its top two bits are 10.
  • f00-1e2d3c4b5a69 plus the rest of the variant digit: 62 random bits.

In v1 the time is split and stored low part first, which is why v1 UUIDs made a second apart look unrelated and don't sort; v6 stores the same fields with the most significant time first. A v4 has only the version and variant digits fixed. To match the overall shape in code, a pattern such as [0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12} with the case-insensitive flag works; try it on your own data in the regex tester.

Name-based UUIDs: v3 and v5

A name-based UUID is a hash, not a random number. The generator joins the 16 bytes of a namespace UUID with the UTF-8 bytes of the name, hashes them (SHA-1 for v5, MD5 for v3), keeps the first 16 bytes and sets the version and variant bits. The result is deterministic: every correct implementation gives the same UUID for the same namespace and name, so separate systems can derive matching IDs without sharing a database.

v5(DNS namespace, "example.com") = cfbff0d1-9375-5685-968c-48ce8b15ae17
v3(DNS namespace, "example.com") = 9073926b-929f-31c2-abc9-fad77ae3e8eb

Names are case- and space-sensitive: Example.com and example.com (with a trailing space) give different UUIDs, so normalize names before hashing. Because anyone can recompute the hash from a guessable name, never use v3 or v5 to hide the name. The same hashes are available on their own in the hash generator.

How likely is a UUID collision?

A v4 UUID is one of 2122, about 5.3 × 1036, possible values. The birthday bound gives the chance that a set ofn random UUIDs contains at least one duplicate: p ≈ 1 − e−n(n−1)/2123. For realistic numbers it is vanishingly small:

Chance of a duplicate among random v4 UUIDs
v4 UUIDs generatedChance of any duplicate
1,000,000about 1 in 1.06 × 10²⁵
1 × 10⁹about 1 in 1.06 × 10¹⁹
1 × 10¹²about 1 in 1.06 × 10¹³
1 × 10¹⁵about 1 in 1.06 × 10⁷
1 × 10¹⁷about 1 in 1,064
3.27 × 10¹⁷1%
2.71 × 10¹⁸50%

A 50% chance needs 2.71 × 10¹⁸ UUIDs: a billion every second for about 86 years. A v7 UUID has fewer random bits (74), but two v7 UUIDs can only collide if they were made in the same millisecond, so the count that matters is how many you create per millisecond, not in total. In practice duplicate UUIDs come from software bugs, such as a random number generator that isn't cryptographic or a forked process that reuses its parent's state, not from bad luck. For values that must stay secret, like reset links or API keys, use a purpose-built random token from the password generator rather than a UUID.

Generate a UUID in code

Most languages and databases can make UUIDs without a library:

Built-in UUID functions by language
Language or toolCodeNotes
JavaScript (browser, Node 19+)crypto.randomUUID()v4; in browsers it needs HTTPS (a secure context)
Pythonimport uuid uuid.uuid4() uuid.uuid7() # Python 3.14+uuid.uuid5(uuid.NAMESPACE_DNS, "example.com") for v5
PostgreSQLSELECT gen_random_uuid(); SELECT uuidv7(); -- PostgreSQL 18+Store in the native uuid type (16 bytes)
MySQLSELECT UUID();Returns v1; UUID_TO_BIN(UUID(), 1) reorders it for indexing
SQL ServerSELECT NEWID();Random (v4); store as UNIQUEIDENTIFIER
.NET (C#)Guid.NewGuid(); Guid.CreateVersion7(); // .NET 9+Guid.ToString() is lower case without braces
JavaUUID.randomUUID();UUID.nameUUIDFromBytes(bytes) makes v3
Gouuid.New() // v4 uuid.NewV7() // v7github.com/google/uuid
macOS / Linux shelluuidgenmacOS prints upper case
PowerShellNew-Guidor [guid]::NewGuid()

Common UUID mistakes

  • Storing UUIDs as text. 36 characters instead of 16 bytes makes every index on the column larger and slower. Use the database's UUID or binary type.
  • Comparing strings case-sensitively. ABC… and abc… are the same UUID. Normalize to lower case, which RFC 9562 recommends for output.
  • Rolling your own with Math.random(). It isn't a cryptographic generator, and some engines have produced duplicate sequences. Use crypto.randomUUID() or crypto.getRandomValues().
  • Publishing v1 UUIDs. They can contain the generating machine's MAC address and the exact creation time. This page uses a random node ID instead, as RFC 9562 allows.
  • Assuming v7 is secret-free. The creation time is readable by anyone. Use v4 where timing is sensitive.
  • Treating a UUID as a password. UUIDs identify things; they aren't designed to be unguessable. Use a dedicated random token for secrets.

A UUID is also just a 128-bit number: the decoder shows it as an integer and in Base64. To convert it to other bases, paste the hex digits into thenumber base converter; for Base64 work see the Base64 encoder and decoder.

Frequently asked questions

What is a UUID?

A UUID (universally unique identifier) is a 128-bit value written as 32 hexadecimal digits in five groups, 8-4-4-4-12, such as 3f2b8c1e-6d4a-4f7b-9c2e-1a5d7e9f0b3c. It is defined by RFC 9562 (May 2024), which replaced RFC 4122. Any computer can make one without asking a central registry, and the chance of two being the same is small enough to ignore in practice.

Is a GUID the same as a UUID?

Yes. GUID (globally unique identifier) is Microsoft's name for the same 128-bit format, and a GUID made by .NET's Guid.NewGuid() or SQL Server's NEWID() is a version 4 UUID. The differences are cosmetic and in storage: Microsoft tools often print GUIDs in upper case and in {braces}, and Guid.ToByteArray() stores the first three groups little-endian, so the raw bytes differ from the text order. This page's decoder shows both byte orders.

What is the difference between UUID v4 and v7?

A v4 UUID is 122 random bits plus 6 fixed bits for the version and variant, so it carries no information and new values land anywhere in a sorted list. A v7 UUID starts with a 48-bit Unix timestamp in milliseconds, followed by 74 bits that are random or partly a counter, so values made later sort after values made earlier and you can read the creation time back out. This generator uses the RFC's counter method, so even v7 UUIDs from the same millisecond come out in order.

Should I use UUID v4 or v7 as a database primary key?

For new tables, v7 is usually the better key. Because each new v7 is larger than the last, inserts go to the end of a B-tree index instead of random pages, which means fewer page splits, a smaller hot set in memory and faster bulk inserts. Choose v4 when the creation time must not be visible in the ID, for example in public URLs. Either way, store the UUID in a native uuid column or BINARY(16), not as 36-character text.

Can two UUIDs ever be the same?

In theory yes, in practice no, as long as they come from a proper random source. A v4 UUID has 2^122 possible values, so by the birthday bound you would need about 2.71 × 10^18 of them for a 50% chance of a single duplicate, which is a billion UUIDs per second for about 86 years. Real duplicates come from bugs such as a badly seeded random number generator or copying IDs, not from chance. The collision calculator on this page works out the odds for any count.

Are UUIDs safe to use as secret tokens or passwords?

Not as a rule. RFC 9562 says implementations should not assume UUIDs are hard to guess. A v4 from a cryptographic generator, like the ones here, does contain 122 unpredictable bits, but other versions expose a timestamp, a MAC address or a hash of a guessable name, and nothing in a UUID's format tells a reader which kind it is. For session tokens, reset links and API keys, use a dedicated random token of at least 128 bits.

How can I tell which version a UUID is?

Look at the 13th hex digit, the first digit of the third group: in 01972ad3-99c0-7d3a-8f00-1e2d3c4b5a69 it is 7, so that is a version 7 UUID. The 17th digit, the first of the fourth group, gives the variant; for standard UUIDs it is 8, 9, a or b. Paste a UUID into the decoder above to get the version, the variant and every field explained.

Can I get the creation date from a UUID?

Only from the time-based versions. A v7 UUID's first 12 hex digits are milliseconds since 1 January 1970 UTC; v1 and v6 hold a count of 100-nanosecond intervals since 15 October 1582. The decoder converts these to a normal date and time. Version 4, 3 and 5 UUIDs contain no time at all.

What are UUID v3 and v5 namespaces?

Name-based UUIDs hash a namespace UUID together with a name, so the same pair always gives the same UUID on any system: the DNS namespace with example.com always produces cfbff0d1-9375-5685-968c-48ce8b15ae17 in v5. RFC 9562 predefines namespaces for DNS names, URLs, ISO OIDs and X.500 distinguished names, and you can use any UUID as your own namespace. v5 uses SHA-1 and v3 uses MD5; prefer v5 for new work.

What are the Nil and Max UUIDs?

The Nil UUID, 00000000-0000-0000-0000-000000000000, has every bit set to zero and is used to mean no value, much like null. The Max UUID, ffffffff-ffff-ffff-ffff-ffffffffffff, has every bit set to one and was added in RFC 9562 as an upper sentinel. Both are valid UUIDs but are not unique, so never hand them out as IDs.

Should UUIDs be upper case or lower case?

RFC 9562 says to output lower case and to accept either case on input, so 3F2B… and 3f2b… are the same UUID. Some Microsoft tools print upper case by default. If you compare UUIDs as plain strings, normalize the case first, or better, compare them in a native UUID type.

Are the UUIDs generated here private?

Yes. Every UUID is generated in your browser with crypto.getRandomValues, the browser's cryptographically secure random number generator, and nothing is sent to a server. The generator remembers your chosen version and format in this browser's local storage; the UUIDs and any names you hash are not saved.

Advertisement