← Back to Tools

UUID Generator

Generate random v4 or time-ordered v7 UUIDs, one at a time or up to 1,000 in bulk, in lowercase, uppercase or GUID format with braces. Paste any UUID into the validator to see its version and embedded timestamp. Everything runs in your browser: nothing is uploaded and there is no signup.

122 random bits from your browser's secure random generator. The default choice for opaque IDs.

Random UUID (version 4)

Generating a UUID…

Bulk UUID generator

Format
Letter case
Output
Quotes
Separator

UUID validator and decoder

Paste a UUID or GUID to check it and read its version, variant and, for v1, v6 and v7, the time it was created.

Frequently Asked Questions

Are UUIDs truly unique?+
Not by guarantee, but close enough that the risk is negligible. A version 4 UUID has 122 random bits, so you would need to generate about 2.71 quintillion (2.71 × 10^18) of them before the chance of a single duplicate reaches 50%. Real-world duplicates almost always come from a weak random number generator, a copied test fixture, or a bug that reuses a value, so keep a unique constraint on the column anyway.
Can I use a UUID as a secret token or API key?+
A v4 UUID from a cryptographically secure generator is unpredictable, but it is not a substitute for a purpose-built secret. It carries only 122 random bits, it looks like an ordinary ID so it tends to end up in logs and URLs, and it has no expiry or signature. Version 1 and version 7 UUIDs also reveal when they were created. For session tokens, password reset links and API keys, use your framework's token generator with at least 128 bits of randomness.
Should I use UUID v4 or v7?+
Use v7 for new database primary keys and anything you want sorted by creation time: the leading timestamp means new rows land at the end of the index, much like an auto-increment key. Use v4 when the ID must reveal nothing, for example public IDs in URLs, because v7 exposes the creation time to the millisecond.
Should UUIDs be uppercase or lowercase?+
RFC 9562 allows uppercase, lowercase or mixed case, but the older RFC 4122 and ITU-T X.667 call for lowercase output and case-insensitive input, so lowercase is the safer default. Windows tools often show GUIDs in uppercase inside braces, which is why this generator offers both. If you compare UUIDs as strings, normalize the case first, or store them in a dedicated UUID column type so the question disappears.
What is the difference between a GUID and a UUID?+
A GUID (globally unique identifier) is Microsoft's name for a UUID. The text format is the same 36 characters, and .NET's Guid.NewGuid() produces a standard version 4 UUID. The visible differences are conventions: GUIDs are often written in uppercase with braces, and Windows stores the first three groups in little-endian byte order when it writes the raw 16 bytes.
Is anything I generate or paste uploaded or logged?+
No. UUIDs are created in your browser with the Web Crypto API (crypto.randomUUID and crypto.getRandomValues), and the validator decodes what you paste locally. Neither the generated values nor the UUIDs you check are sent to a server.

Learn More

Writing tests, specs or developer docs? These guides pair well with a UUID generator:

What Is a UUID (or GUID)?

A UUID (universally unique identifier) is a 128-bit value that any system can create on its own, without asking a central server for the next number, and still be confident nobody else will create the same one. It is written as 32 hexadecimal digits in five groups, 8-4-4-4-12, for 36 characters in total:

017f22e2-79b0-7cc3-98c4-dc0c0c07398f

The first digit of the third group is the version (7 here), and the first digit of the fourth group holds the variant, which is 8, 9, a or b for standard UUIDs. That is why a v4 UUID always matches the pattern xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

The current standard is RFC 9562, published in May 2024. It replaces RFC 4122, keeps versions 1 to 5 as they were, and adds versions 6, 7 and 8 plus the Max UUID (all bits set to one).

UUID vs GUID: GUID is the name Microsoft uses for the same thing. Windows tools such as the registry tend to show GUIDs in uppercase with braces, like {3F2504E0-4F89-41D3-9A0C-0305E82C3301}, but the value underneath is a regular UUID. (.NET's Guid.ToString() prints lowercase without braces by default.) The one practical difference shows up in binary: Windows stores the first three groups little-endian, so raw 16-byte GUIDs can look scrambled when another system reads them.

UUID Versions Compared

The version tells you how the 128 bits were built. These six versions cover nearly every real use:

VersionBuilt fromSorts by timeGood for
v1Timestamp (100 ns since 1582), clock sequence, node ID (MAC address or random)No, low time bits come firstLegacy systems that already use it
v3 / v5MD5 (v3) or SHA-1 (v5) hash of a namespace plus a nameNoThe same input must always give the same ID
v4122 random bitsNoOpaque IDs that reveal nothing
v6The v1 fields reordered, most significant time bits firstYesMoving an existing v1 system to sortable IDs
v748-bit Unix timestamp in milliseconds plus random bitsYesDatabase primary keys, events, logs

Which one to pick: use v7 for new database keys and v4 for opaque random IDs. Random v4 keys land at random positions in a B-tree index, which causes page splits and poor cache use as tables grow. A v7 key starts with the time, so new rows are appended near the end of the index and stay close to their neighbors. The trade-off is that anyone holding a v7 UUID can read when it was created.

Version 2 (DCE Security) is almost never used, and version 8 is a free-form layout for vendor-specific schemes. One database caveat: SQL Server sorts uniqueidentifier values starting from the last group, so v7 does not give you index locality there without extra work.

How Likely Is a UUID Collision?

Six of the 128 bits in a v4 UUID are fixed by the version and variant, which leaves 122 random bits, or about 5.3 × 10^36 possible values. The birthday problem puts the numbers in perspective:

  • You need roughly 2.71 quintillion (2.71 × 10^18) v4 UUIDs for a 50% chance that any two match.
  • At one billion UUIDs per second, it would take about 86 years to get there.
  • After 103 trillion UUIDs, the chance of a single duplicate is still about one in a billion.

The math only holds when the bits are truly random. Duplicates in practice come from weak generators such as snippets built on Math.random, from bugs that reuse a value, and from test fixtures copied between environments. This page uses crypto.randomUUID() and crypto.getRandomValues(), the browser's cryptographically secure source. For v7 it follows RFC 9562's counter method, so UUIDs generated in the same millisecond still come out unique and in order.

How to Generate a UUID in Code

Most languages and databases ship a UUID function, so you rarely need a library for v4. Built-in v7 support is newer, so check your version.

JavaScript (browsers and Node.js)

crypto.randomUUID();                      // v4, secure contexts (HTTPS) only
import { randomUUID } from "node:crypto";  // Node.js

Python

import uuid
uuid.uuid4()   # v4
uuid.uuid7()   # v7, Python 3.14+

PostgreSQL and MySQL

SELECT gen_random_uuid();  -- PostgreSQL 13+, v4
SELECT uuidv7();           -- PostgreSQL 18+, v7
SELECT UUID();             -- MySQL, returns a version 1 UUID

C# (.NET) and Java

Guid.NewGuid();          // C#, v4
Guid.CreateVersion7();   // C#, v7, .NET 9+
UUID.randomUUID();       // Java, v4

Terminal (macOS and Linux)

uuidgen                          # random v4; macOS prints uppercase
uuidgen | tr '[:upper:]' '[:lower:]'

In MySQL, UUID_TO_BIN(UUID(), 1) stores the value in 16 bytes and swaps the time fields so that indexed v1 values cluster better. For v7 in JavaScript, the uuid package on npm exports a v7() function.

Using UUIDs as Test Data in QA

UUIDs solve a surprising number of testing problems because they are unique without any coordination between test runs:

  • Unique fixtures: add a UUID to usernames, emails or order references (for example qa+<uuid>@example.com) so parallel CI jobs never trip over the same unique constraint.
  • Idempotency keys: send the same UUID in an Idempotency-Key header on a retried POST and check that the payment or order is created only once.
  • Correlation IDs: set a UUID in a request header such as X-Request-ID, then search every service's logs for it. Paste that ID into the bug report so developers can find the exact request.
  • Seeding and cleanup: generate 100 IDs as a JSON array for fixture files, or as an SQL IN (…) list to select or delete exactly the rows a test created.
  • Validator edge cases: feed your API the Nil UUID, the Max UUID, uppercase values, braces, missing hyphens and a v1 where a v4 is expected, and confirm it accepts or rejects each one on purpose.

When a test fails on a specific record, paste its ID into the validator above. A v7 or v1 ID tells you when the record was created, which often narrows down the deploy or the test run that produced it.

Related Tools