KKC Tools
All tools →

UUID Generator: Create Random UUIDs (v4, v7) and GUIDs

Generate RFC 9562 v4 random, v7 time-ordered, v5 (SHA-1), and v3 (MD5) UUIDs or Microsoft-style GUIDs, export up to 1,000 at once, and inspect or validate any identifier offline.

Generate valid RFC 9562 UUIDs and Microsoft-format GUIDs in your browser: random v4 (122 random bits), sortable timestamp-ordered v7, deterministic v5 (SHA-1) or v3 (MD5), or validate and inspect any UUID. Create up to 1,000 at once and copy or download — nothing leaves your device.
UUID Anatomy Diagram (8-4-4-4-12)Five hyphen-separated hexadecimal segments totaling 32 hex digits (36 characters, 128 bits).1 32 hex digits = 128 bits · 4 Hyphens (36 characters total)122 random bits · ×1550e8400-e29b-41d4-a716-4466554400008 hex (time/rand)2 Version (M)3 Variant (8, 9, a, b)7 How many: 1 · 8 Format & encoding options below
UUID anatomy (8-4-4-4-12 · 128 bits)UUID Anatomy Diagram (8-4-4-4-12)Five hyphen-separated hexadecimal segments totaling 32 hex digits (36 characters, 128 bits).1 32 hex digits = 128 bits · 4 Hyphens (36 characters total)122 random bits · ×1550e8400-e29b-41d4-a716-4466554400008 hex (time/rand)2 Version (M)3 Variant (8, 9, a, b)7 How many: 1 · 8 Format & encoding options below
List presets:

Ready to generate in your browser.

xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx

Generated in your browser with Web Crypto (crypto.getRandomValues). No API calls, nothing stored.

  • v4, v7 & v5 (RFC 9562)
  • Bulk up to 1,000
  • Validate & decode
  • Code for 6 languages

100% free · No sign-up · Runs in your browser, nothing is uploaded

How to Generate a UUID

This UUID and GUID generator operates entirely client-side inside your browser across five tabs:

  • 1. v4 (Random): Choose how many (1 to 1,000), the case, hyphens, braces, URN or Base64, then copy or download the list.
  • 2. v7 (Time-Ordered): The same options for IDs that sort by creation time. The list presets give plain text, a SQL IN list, JSON or CSV.
  • 3. v5 / v3 (Name): Supply a standard RFC 9562 namespace (DNS, URL, OID, X.500, or custom UUID) plus a UTF-8 name string to compute deterministic SHA-1 (v5) or MD5 (v3) UUIDs.
  • 4. Validate & Convert: Paste a UUID or GUID to check its format, see its version and variant, convert it, and read the time inside v1, v6 and v7 values.
  • 5. Nil & Max: Copy the empty (nil) GUID or the Max UUID.

Which UUID Version Should I Use?

RFC 9562 defines eight UUID versions, though most modern applications rely on three: v4, v7, and v5. Choosing the right version depends on whether you need unpredictability, database index locality, or deterministic repeatability.

Comparison of common UUID versions (RFC 9562)
VersionMechanismRandom / Hash BitsSortable?Best Use Case
v4Cryptographic RNG122 random bitsNo (random)General IDs and URLs where creation time should stay hidden
v748-bit Unix ms + counter + RNGUp to 74 bitsYes (time-ordered)Database primary keys, distributed logs, ordered event streams
v5SHA-1(namespace + name)122 hash bitsNo (deterministic)Idempotent IDs derived from URLs, domains, or external keys
v3MD5(namespace + name)122 hash bitsNo (deterministic)Legacy compatibility only; prefer v5 for new designs
v1Gregorian timestamp + MAC60-bit time + nodeByte-swappedLegacy systems; leaks hardware MAC address and clock

UUID v4 (Random) and Collision Odds

A version 4 UUID fills 122 of its 128 bits using a cryptographically secure pseudorandom number generator (here, Web Crypto crypto.getRandomValues). The remaining 6 bits are fixed: 4 bits hold the version nibble (0100, hex 4) and 2 bits hold the RFC variant (10, hex 8, 9, a, or b).

Because there are 2¹²² ≈ 5.3169 × 10³⁶ unique v4 values, accidental collisions are astronomically unlikely when using a proper CSPRNG. Under the birthday approximation p ≈ n² / (2 × 2¹²²), generating 1 billion (10⁹) v4 UUIDs yields a collision probability around 9.4 × 10⁻²⁰. Generating 5 × 10⁹ UUIDs gives roughly 2.35 × 10⁻¹⁸, and reaching a 50% collision chance requires approximately 2.71 × 10¹⁸ UUIDs—more than 100 million per second for 850 years.

UUID v7 (Time-Ordered) and Database Indexing

Random v4 UUIDs hurt write throughput on large relational tables because every insert lands at a random page in a B-tree index (PostgreSQL, MySQL InnoDB, SQL Server). Over millions of rows, random writes fragment the index and thrash the buffer pool.

Standardized in RFC 9562 §5.7, UUIDv7 solves this by putting a big-endian 48-bit Unix epoch millisecond timestamp in the first 6 bytes, followed by version 7 (0111), 12 bits of monotonic sub-millisecond counter or random bits, the 10 variant, and 62 random bits. When generating bulk v7 batches inside the same millisecond, this tool implements RFC 9562 monotonic counter incrementing (Method 1/2) so every generated ID strictly sorts after the previous one.

UUID v5 and v3 (Name-Based)

Name-based UUIDs produce the exact same 128-bit output every time you combine the same 16-byte namespace UUID with the same UTF-8 string. RFC 9562 defines four standard namespaces:

  • DNS: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
  • URL: 6ba7b811-9dad-11d1-80b4-00c04fd430c8
  • OID: 6ba7b812-9dad-11d1-80b4-00c04fd430c8
  • X.500 DN: 6ba7b814-9dad-11d1-80b4-00c04fd430c8

For example, hashing the DNS namespace with www.example.com produces 2ed6657d-e927-568b-95e1-2665a8aea6a2 under v5 (SHA-1) and 5df41881-3aed-3515-88a7-2f4a814cf09e under v3 (MD5). Both can also accept any valid custom UUID as a namespace.

UUID vs GUID: Is There a Difference?

In everyday software engineering, UUID and GUID refer to the same 128-bit identifier specification. However, ecosystem conventions differ in presentation and binary layout:

  • Canonical UUID (RFC 9562): Lowercase hexadecimal with hyphens (550e8400-e29b-41d4-a716-446655440000), stored in network big-endian byte order.
  • Microsoft GUID: Often displayed uppercase or wrapped in curly braces ({550E8400-E29B-41D4-A716-446655440000}). In Windows COM and System.Guid byte arrays, the first three fields (time_low, time_mid, time_hi_and_version) are stored in little-endian order while the last 8 bytes remain big-endian.

Use the format options to output standard canonical UUIDs, uppercase GUIDs, braced GUIDs, 32-character hex strings without hyphens, or RFC URN format (urn:uuid:...).

UUID Format and Byte Layout

A canonical UUID consists of 32 hexadecimal characters (16 bytes = 128 bits) separated into five groups of lengths 8-4-4-4-12:

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

Here M (the 13th hex digit) indicates the version (e.g., 4 for random or 7 for time-ordered), and N (the 17th hex digit) encodes the variant. Standard RFC 4122 / RFC 9562 UUIDs have their two most significant bits of that byte set to 10, restricting N to 8, 9, a, or b.

Nil and Max UUIDs

RFC 9562 specifies two special sentinel UUIDs that bypass normal version/variant checks:

  • Nil UUID: 00000000-0000-0000-0000-000000000000 — all 128 bits set to zero, useful for representing an uninitialized or empty foreign-key placeholder without nullable columns.
  • Max UUID: ffffffff-ffff-ffff-ffff-ffffffffffff — all 128 bits set to one, standardized in RFC 9562 §5.10 as an upper-bound sentinel for sorted range scans and pagination.

How to Validate a UUID

A naive 32-hex regex accepts invalid strings with bogus version or variant bits. To validate a standard RFC 9562 UUID strictly (versions 1 through 8, variant 10xx), match against:

^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

Remember to allow the Nil and Max UUIDs explicitly if your application treats them as valid sentinels, and apply case-insensitive matching (/i) if Microsoft uppercase GUIDs are accepted.

Generate UUIDs in Code

Built-in standard library commands for new UUIDs. Databases differ in the version they return, so check yours:

JavaScript / Node.js / Browser

crypto.randomUUID()

Python

import uuid print(uuid.uuid4())

C# / .NET

Guid.NewGuid().ToString() // standard form Guid.NewGuid().ToString("B") // with braces

Java

import java.util.UUID; UUID.randomUUID().toString();

SQL: PostgreSQL (13+), SQL Server, MySQL

SELECT gen_random_uuid(); -- PostgreSQL, v4 SELECT NEWID(); -- SQL Server SELECT UUID(); -- MySQL, v1

PowerShell

[guid]::NewGuid().ToString()

Security Notes: CSPRNG & Predictability

UUIDs are designed for uniqueness, not secrecy. Version 1 leaks the host MAC address and creation timestamp; version 7 reveals millisecond creation timestamps; versions 3 and 5 are deterministic hashes of known inputs. Even version 4 (122 random bits) relies entirely on the quality of the underlying random number generator—always use Web Crypto crypto.getRandomValues or OS CSPRNGs rather than Math.random(), and do not use standard UUIDs as passwords or unhashed bearer secrets where cryptographic tokens are required.

Frequently Asked Questions

What is a UUID, and what does GUID stand for?

UUID stands for Universally Unique Identifier, and GUID for Globally Unique Identifier. It is a standardized 128-bit (16-byte) label defined in RFC 9562 (which replaced RFC 4122) and ISO/IEC 9834-8, written as 32 hexadecimal digits in five hyphen-separated groups (8-4-4-4-12) so distributed systems can create unique IDs without a central coordinator.

What is the difference between a UUID and a GUID?

Technically they share the same 128-bit RFC 9562 / ISO 9834-8 structure. "UUID" is the IETF/Linux/Postgres term formatted in lowercase hyphens, while "GUID" (Globally Unique Identifier) is Microsoft’s term in .NET, Windows, and SQL Server, often formatted in uppercase, wrapped in braces {...}, or stored in mixed-endian byte order for legacy COM APIs.

Are UUIDs truly unique — can two v4 UUIDs collide?

A UUIDv4 contains 122 random bits (6 bits are fixed for version 4 and variant 10), giving 5.3 × 10^36 possible values. By the birthday bound, you would need roughly 2.71 × 10^18 UUIDs (about one billion per second for 85 years) to reach a 50% chance of a single duplicate, assuming a cryptographic RNG.

Which UUID version should I use: v4, v7, or v5?

Use v7 for new database primary keys and event logs because its leading 48-bit Unix millisecond timestamp keeps B-tree inserts sequential. Use v4 when you want pure randomness with no embedded timestamp. Use v5 (SHA-1) when you need the exact same deterministic UUID every time for a given namespace and input name.

Why is UUIDv7 better for database primary keys than v4?

Random v4 UUIDs scatter inserts across the entire B-tree index, causing frequent page splits and cache misses on large tables. UUIDv7 places a monotonically increasing 48-bit millisecond timestamp in the most significant bits, so new rows append near the end of the index like an auto-increment integer while remaining globally unique.

What is the difference between UUIDv3 and UUIDv5?

Both are deterministic name-based versions that hash a 16-byte namespace UUID and a UTF-8 name string. Version 3 uses MD5 and version 5 uses SHA-1 cut to 128 bits. Both then replace 6 bits with the version and variant. RFC 9562 recommends v5 over v3 for new systems unless legacy compatibility requires MD5.

What is an empty (nil) GUID, and what is the Max UUID?

The Nil UUID (00000000-0000-0000-0000-000000000000) has all 128 bits set to zero and represents a null or unset identifier. RFC 9562 also defines the Max UUID (ffffffff-ffff-ffff-ffff-ffffffffffff) with all 128 bits set to one as an upper sentinel value for range queries.

How long is a UUID or GUID?

It is 128 bits (16 bytes): 32 hex digits, or 36 characters with the four hyphens. In Base64 it is 24 characters with padding, and 22 in base64url without it.

How do I generate a UUID in C#, Python, Java, SQL or PowerShell?

C#: Guid.NewGuid(). Python: uuid.uuid4(). Java: UUID.randomUUID(). PostgreSQL 13+: gen_random_uuid(). PowerShell: [guid]::NewGuid(). Each is shown as a code block in the section above.

How do I validate a UUID?

Check the 8-4-4-4-12 canonical layout with the version nibble (13th hex digit) in [1-8] and the variant nibble (17th hex digit) in [89ab]: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ (case-insensitive), plus optional special checks for Nil and Max UUIDs. Paste any string into the Validate tab above to inspect its exact version, variant, and embedded v7 timestamp.

Can I generate UUIDs offline or in bulk?

Yes. Every generation mode (v4, v7, v5, v3, Nil/Max) and the validator run strictly inside your browser using Web Crypto (crypto.getRandomValues and crypto.subtle.digest). Generate up to 1,000 UUIDs in one click and copy or download them as .txt or .json without sending anything over the network.

Are UUIDs secure as passwords or API tokens?

Standard v7, v5, v3, and v1 UUIDs are not secret—they leak timestamps or deterministic inputs and should never be used as bearer tokens or passwords. Even v4 (122 random bits) relies on a cryptographic CSPRNG; if you need an authentication secret, generate a dedicated high-entropy token or password instead.

What changed in RFC 9562 compared to RFC 4122?

Published in May 2024, RFC 9562 obsoleted RFC 4122. It kept v1 through v5 unchanged, standardized time-ordered UUIDv6, epoch-ms UUIDv7, and custom/experimental UUIDv8, formalized the Max UUID (all F), and documented monotonic sub-millisecond counter methods for v7.

Related Developer Tools

  • Password Generator: Generate high-entropy secret tokens and passwords (when a UUID should not be used as a secret).
  • Comma Separator: Format bulk UUIDs or columns into SQL IN clauses, CSVs, and JSON arrays.

How This Calculator Works: Formula, Defaults & Sources

Formula

  • UUIDv4: 122 bits from Web Crypto crypto.getRandomValues + 4-bit version (0100) + 2-bit RFC variant (10)
  • UUIDv7 (RFC 9562): 48-bit big-endian Unix ms timestamp + version (0111) + 12-bit monotonic counter + variant (10) + 62 random bits
  • UUIDv5 / v3: SHA-1 (v5) or MD5 (v3) over 16-byte namespace UUID || UTF-8 name bytes, formatted with version & variant bits
  • v4 Collision probability (birthday approximation): p ~= n^2 / (2 * 2^122)

Default values (you can change them)

  • Default mode: UUIDv4 canonical lowercase (8-4-4-4-12)
  • Bulk limit: Up to 1,000 UUIDs per click (monotonic counter supported for v7)
  • Standard namespaces: RFC 9562 DNS, URL, OID, X.500 DN, or custom UUID

Sources

Counts follow the rules above. Estimates are a guide: your document, form or platform has the final say. Last updated: November 25, 2026. Spotted a wrong number? Email us or use the contact page.

💡Suggest a Tool