Skip to main content

UUID Generator

Generate cryptographically secure RFC 9562 UUIDs (v1, v4, v6, and time-ordered v7) individually or in batches up to 10,000, with instant validation, custom formatting, and language snippets.

UUID Generator — Interactive Browser WorkspaceGenerate cryptographically secure RFC 9562 UUIDs (v1, v4, v6, and time-ordered v7) individually or in batches up to 10,000, with instant validation, custom formatting, and language snippets.
100% Client-Side • Zero Server Upload
Sample Input / Parameters — Standard UUID v4
Generate 1 UUID v4
Ready locally via WebAssembly & JavaScript
Expected Output / Live Result
123e4567-e89b-12d3-a456-426614174000
100% Client-Side • Zero Server Upload

Distributed systems cannot rely on a single database sequence without introducing a coordination bottleneck, and exposing sequential integers (/orders/4019) leaks business volume while inviting Insecure Direct Object Reference (IDOR) scraping. Universally Unique Identifiers (UUIDs)—called GUIDs in Microsoft .NET and Win32 ecosystems—solve both problems by packing globally collision-resistant identity into a fixed 128-bit structure standardized under IETF RFC 9562 (which obsoleted RFC 4122 in May 2024). This workspace generates, formats, and validates v1, v4, v6, and v7 UUIDs locally inside your browser using native Web Crypto entropy, keeping production identifiers private and off the wire.

Canonical 128-Bit Layout and Variant Encoding

Every canonical UUID prints as 32 hexadecimal nibbles separated into five hyphenated groups (8-4-4-4-12, 36 ASCII characters total):

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
              ^    ^
              |    └── Variant nibble: 8, 9, a, or b (binary 10xx = RFC 9562)
              └─────── Version nibble: 1, 4, 6, or 7

Six bits are reserved as structural metadata across standard RFC versions: the 4-bit ver field at octet 6 high nibble, and the 2-bit var field (10 in binary) at octet 8 high bits. That leaves 122 variable bits whose internal allocation differs sharply between versions.

UUID VersionTime RepresentationRandom / Node BitsLexicographically SortablePrivacy / MAC ExposurePrimary Engineering Fit
UUID v160-bit 100ns ticks since 1582-10-15 (low bits first)14-bit clock_seq + 48-bit MAC/nodeNo (time fields split)High if real MAC usedLegacy distributed systems and audit compatibility
UUID v4None122 CSPRNG random bitsNo (uniformly scattered)NonePublic API URLs, correlation IDs, opaque tokens
UUID v660-bit Gregorian 100ns ticks (big-endian reordered)14-bit clock_seq + 48-bit nodeYesModerate (use random node)Drop-in sortable migration path from legacy v1
UUID v748-bit big-endian Unix Epoch milliseconds (1970-01-01)12-bit rand_a (or counter) + 62-bit rand_bYes (native chronological)None (timestamp only)Modern relational/NoSQL primary keys, event logs

Why UUID v7 Fixes B-Tree Index Fragmentation

In relational storage engines such as PostgreSQL heap/B-Tree indexes and MySQL InnoDB clustered primary keys, key ordering dictates physical disk I/O. Inserting millions of random UUID v4 primary keys forces the database to locate and mutate seemingly random leaf pages across the entire index tree:

  1. Page Splits & Write Amplification: Half-filled B-Tree pages split continuously, inflating index size by 30%–50% and doubling PostgreSQL Write-Ahead Log (WAL) full-page image writes.
  2. Buffer-Pool Thrashing: Because active writes hit cold pages scattered across gigabytes of index data rather than only the rightmost leaf page, cache hit ratios plummet once the index outgrows RAM.

UUID v7 resolves this cleanly. Its top 48 bits encode Unix epoch milliseconds in big-endian byte order (valid through the year 10889 AD), followed by 74 random or monotonic counter bits. Consecutive records append cleanly to the trailing edge of the B-Tree—delivering insert throughput close to 64-bit BIGINT sequences while remaining stateless and globally unique across multi-region writers. Keep one security nuance in mind: because v7 reveals record creation time down to the millisecond, prefer UUID v4 for security-sensitive bearer identifiers or URLs where creation timestamps must stay hidden.

Birthday-Paradox Collision Math

Collision probability for uniformly random kk-bit identifiers follows the birthday approximation:

P(collision)≈1−exp⁡ ⁣(−n22⋅2k)P(\text{collision}) \approx 1 - \exp\!\left(-\frac{n^2}{2 \cdot 2^k}\right)

For UUID v4 (k=122k = 122, 2122≈5.32×10362^{122} \approx 5.32 \times 10^{36}), generating n=1012n = 10^{12} (one trillion) identifiers produces a collision probability below 10−1310^{-13}. Reaching a 50% collision chance requires n≈2.71×1018n \approx 2.71 \times 10^{18} IDs—equivalent to minting 1 billion UUIDs every second for more than 85 years. For UUID v7, the 74 random bits per millisecond yield 274≈1.89×10222^{74} \approx 1.89 \times 10^{22} distinct states inside every single millisecond window, and RFC 9562 §6.2 permits using the 12-bit rand_a field as a monotonic counter for deterministic same-millisecond ordering.

Database Storage, Validation Regex, and Endianness Gotchas

Never store UUIDs as VARCHAR(36) in production tables; binary storage halves memory footprint and accelerates index comparisons dramatically:

-- PostgreSQL: native 16-byte uuid type (v4 built-in; v7 native in PG 18 / extensions)
CREATE TABLE events (
  id UUID PRIMARY KEY,
  payload JSONB NOT NULL
);

-- MySQL 8: compact 16-byte storage (pass swap_flag=1 only for v1, NOT v7)
CREATE TABLE events (
  id BINARY(16) PRIMARY KEY,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO events (id) VALUES (UUID_TO_BIN('019345a2-8c1d-7f2e-9a41-3b7e2f8c1d09', 0));

Watch out for two subtle cross-platform pitfalls:

  • MySQL UUID_TO_BIN(uuid, 1) trap: The second argument 1 rearranges UUID v1 time octets for sorting. Never pass 1 for UUID v7, which is already big-endian sorted—doing so scrambles its timestamp prefix!
  • Microsoft .NET GUID Byte Order: Guid.ToByteArray() in C# encodes the first three groups (Data1, Data2, Data3) in little-endian order while leaving the final two groups big-endian. When exchanging raw 16-byte blobs between C# and PostgreSQL or Go, use Guid.ToByteArray(bigEndian: true) (.NET 8+) or serialize via canonical strings.

For strict RFC 9562 input validation (matching versions 1, 4, 6, or 7 and variant 8/9/a/b), use:

^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1467][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$

Handling Nil, Max, and Clock-Drift Edge Cases

RFC 9562 also reserves two sentinel values that developers should recognize in schema migrations and boundary tests: the Nil UUID (00000000-0000-0000-0000-000000000000), commonly used to represent an unset foreign key without nullable columns, and the Max UUID (ffffffff-ffff-ffff-ffff-ffffffffffff), useful as an exclusive upper range bound in partitioned B-Tree queries. When deploying UUID v7 across fleet nodes synchronized via NTP, ensure your library implements RFC 9562 monotonic counter handling so backward clock adjustments or burst writes within the same millisecond never invert sort order or collide across threads.

Pairing UUIDs Across Your Development Pipeline

After exporting a bulk JSON array of up to 10,000 IDs, you can pretty-print or merge them into larger API payloads with our JSON Formatter or build realistic multi-field test fixtures in the API Mock Data Generator. If your schema requires URL-compact NanoID-style keys shorter than 36 characters or custom prefix patterns like usr_..., switch to the Random String Generator.

How to Use UUID Generator

1

Choose your target specification on the Generator tab: v4 for pure unpredictability, v7 for chronological database indexing, or v1/v6 for legacy time-based pipelines.

2

Pick a single ID or configure a bulk count up to 10,000 identifiers using the quick presets or custom numeric input.

3

Toggle formatting modifiers as needed—Uppercase, Remove Hyphens, Add Braces, or Add Quotes—to match your target language or SQL syntax.

4

Click Generate to mint fresh identifiers locally, then copy individual rows or download the full batch as TXT, CSV, or JSON.

5

Switch to the Validator tab to verify external UUID strings, or open Developer Snippets to copy native library code for your backend stack.

Real Examples

Standard UUID v4

The default format for a randomly generated UUID v4.

Input
Generate 1 UUID v4
Output
123e4567-e89b-12d3-a456-426614174000

No Hyphens (Uppercase)

UUID formatted without hyphens and converted to uppercase.

Input
Generate UUID (No Hyphens, Uppercase)
Output
123E4567E89B12D3A456426614174000

JSON Array Format

Generating a bulk list of UUIDs formatted as a JSON array.

Input
Generate 3 UUIDs -> Copy as JSON Array
Output
[
  "550e8400-e29b-41d4-a716-446655440000",
  "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
  "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
]

Frequently Asked Questions

Why does UUID v7 outperform UUID v4 as a PostgreSQL or MySQL primary key?
UUID v4 is completely random, so new inserts scatter across random leaf pages of a B-Tree index, triggering page splits, write amplification, and buffer-pool cache misses. UUID v7 places a 48-bit millisecond Unix timestamp in the most significant bits, keeping inserts monotonically ordered at the right edge of the B-Tree.
What changed when RFC 9562 replaced the older RFC 4122 UUID specification?
Published by the IETF in May 2024, RFC 9562 officially standardized time-ordered UUID v6, Unix-epoch UUID v7, and custom-layout UUID v8, while deprecating MAC-based v1 for privacy-sensitive designs and defining formal monotonicity methods for sub-millisecond v7 bursts.
How should I store UUIDs in SQL databases to save disk space and RAM?
Avoid storing 36-character ASCII strings in VARCHAR(36) or CHAR(36) columns, which consume 36+ bytes and bloat every secondary index. Use native 16-byte UUID columns in PostgreSQL, UNIQUEIDENTIFIER in SQL Server, or BINARY(16) with UUID_TO_BIN() in MySQL 8.
Does the built-in UUID Validator accept uppercase, braced, or hyphenless GUIDs?
Yes. Before verifying canonical RFC structure, version nibble, and variant bits, the Validator tab strips optional curly braces ({...}) and surrounding quotes, and automatically normalizes 32-character unhyphenated hexadecimal strings back into standard 8-4-4-4-12 layout.
How likely is a UUID v4 or v7 collision in a high-throughput distributed system?
UUID v4 carries 122 random bits (5.3 x 10^36 states), requiring roughly 2.71 x 10^18 IDs to reach a 50% birthday-paradox collision risk. UUID v7 embeds 74 bits of randomness (or monotonic counter plus random bits) per millisecond, making accidental collisions negligible even across globally distributed write clusters.

Key Features

  • Full RFC 9562 generation across four versions: v1 (Gregorian/MAC), v4 (CSPRNG random), v6 (reordered time), and v7 (Unix epoch time-sorted)
  • High-speed bulk batch engine producing up to 10,000 formatted UUIDs in a single client-side pass
  • Granular string formatters for uppercase hex, hyphen removal (32-char compact), Microsoft {braces}, and double-quote wrapping
  • Dedicated Validator tab that normalizes wrapped or unhyphenated strings and checks RFC structural validity
  • Copy-ready Developer Snippets tab covering JavaScript/TypeScript, Node.js, Python, Java, C#/.NET, and PostgreSQL
  • One-click clipboard export and file downloads in TXT, JSON array, and CSV formats with local 10-batch session history

Common Use Cases

  • Designing high-throughput PostgreSQL, MySQL, or CockroachDB schemas with B-Tree-friendly UUID v7 primary keys
  • Generating unguessable UUID v4 resource identifiers to eliminate sequential IDOR enumeration vulnerabilities in REST APIs
  • Seeding staging tables, integration fixtures, and load-test payloads with up to 10,000 bulk unique IDs
  • Creating Microsoft .NET, COM, or SQL Server braced uppercase GUID literals for registry and config migrations
  • Assigning distributed trace and correlation IDs across microservices, message queues, and offline-first mobile clients
  • Validating incoming third-party webhook identifiers and legacy database keys for RFC compliance

Explore More Tools in This Category

View All Developer & Utility Tools

SEO Slug Generator

Transform headlines, product titles, and international strings into RFC 3986 URL-safe slugs with multi-language Unicode transliteration, bulk conversion, SEO length scoring, and framework code snippets.

Lorem Ipsum & Dummy Text Generator

Generate classic Ciceronian Lorem Ipsum or six domain-themed vocabularies by exact words, sentences, paragraphs, or characters—formatted as plain text, semantic HTML, or Markdown.

Fake User Data Generator

Generate deterministic, privacy-safe synthetic user records localized across 8 regions for database seeding, UI layout testing, and API fixtures. Export directly to JSON, CSV, PostgreSQL, MySQL, XML, and YAML.

Random Number Generator Tool & Simulator

Generate Web Crypto random integers, fixed-precision decimals, polyhedral RPG dice rolls, numeric OTP tokens, and custom list picks with live descriptive statistics and JSON/CSV export.

API Mock Data Generator

Design nested JSON API schemas with 40+ semantic field types, simulate REST latency and HTTP error codes, and export payloads alongside TypeScript, Zod, GraphQL, and JSON Schema contracts.

HTML Table Generator

Visually design, style, and export accessible, responsive HTML tables right in your browser. Import CSV, TSV, or JSON data, merge cells, test desktop-to-mobile viewports, and compile clean HTML, Tailwind CSS, React JSX, Bootstrap, or Markdown.

Username Generator

Create platform-validated, memorable handles for gaming, social media, software engineering, and brand accounts with leetspeak mutations, heuristic scoring, and TXT, CSV, or JSON bulk exports.

Random String Generator

Generate cryptographically secure API keys, session tokens, JWT signing secrets, compact database IDs, and pattern-masked coupon codes in bulk up to 5,000 deduplicated strings offline.