UUID Generator
Generate secure, cryptographically random Version 4 UUIDs in bulk instantly in your browser.
UUID collision calculator
Estimate the chance of at least one collision using the birthday-bound approximation. This is probability, not a guarantee.
Estimated collision probability: 9.404e-26 (9.404e-24%)
Formula: 1 − e−n(n−1)/(2·2b), where n is the count and b is the assumed random-bit count. Both v4 and v7 results are approximations under the stated randomness assumptions.
Local generation benchmark
Runs 100,000 bounded operations locally in small chunks. Results vary by browser, device, and current workload.
Validate a UUID
Features
- Bulk Generation up to 10,000: Instantly generate up to 10,000 UUIDs in milliseconds without freezing your browser.
- RFC 9562 UUID v4 & v7: Generate purely random v4 identifiers or modern time-ordered v7 identifiers using your browser's native Web Crypto API.
- Database-Optimized v7: UUID v7 pairs a 48-bit millisecond timestamp with random entropy to prevent database B-Tree index fragmentation.
- Customizable Output: Instantly toggle uppercase letters, strip hyphens, or format strings for direct SQL and code embedding.
- 1-Click Export: Copy individual UUIDs, copy the entire batch, or download formatted TXT and CSV export files.
- Collision Probability Calculator: Explore birthday-bound collision approximations across different identifier generation volumes.
- 100% In-Browser & Zero Tracking: All identifiers are generated locally on your device using cryptographically secure PRNG.
How it works
A Universally Unique Identifier (UUID) is a standardized 128-bit identifier represented as 32 hexadecimal characters grouped into 5 segments: 8-4-4-4-12 (e.g., 019468a2-9473-7b31-89ab-9f5e3d7b889a).
Select UUID v4 (Random) for unpredictable identifiers where insertion order does not matter, or choose UUID v7 (Time-Sortable) for primary keys in distributed databases like PostgreSQL, MySQL, or MongoDB. Configure your desired count and formatting toggles, then click Generate.
UUID v4 vs. UUID v7: Which Should You Use?
Selecting between UUID v4 and v7 depends on your storage architecture and privacy requirements:
| Characteristic | UUID v4 (RFC 4122 / 9562) | UUID v7 (RFC 9562) |
|---|---|---|
| Structure | 122 random bits + 6 version/variant bits | 48-bit timestamp (ms) + 74 random bits |
| Time Sortable | No (Completely random) | Yes (Chronologically ordered) |
| Database B-Tree Performance | High fragmentation on large tables | Optimal write locality, minimal page splits |
| Creation Time Leaked | No (Maximum privacy) | Yes (Millisecond timestamp visible in header) |
| Ideal Use Case | Anonymous tokens, session IDs, private keys | Primary keys in SQL/NoSQL databases, event streams |
How to Generate UUIDs in Code
Modern libraries and native language methods for generating UUID v4 and v7 identifiers:
JavaScript / TypeScript (Node.js & Browser)
// Native UUID v4 (Node 14.17+ & Modern Browsers)
const id = crypto.randomUUID();
console.log(id); // e.g. "c9b88235-9f22-4917-a128-4efc9823ef0e"
// UUID v7 via official 'uuid' package
import { v7 as uuidv7 } from "uuid";
const timeSortedId = uuidv7();
console.log(timeSortedId); // e.g. "019468a2-9473-7b31-89ab-9f5e3d7b889a"Python 3
import uuid # Standard UUID v4 v4_id = uuid.uuid4() print(str(v4_id)) # e.g. "a54cf8a1-2e65-4f40-97b7-548ea23f95f2" # UUID v7 (Python 3.14+ standard library or 'uuid6' package) # pip install uuid6 import uuid6 v7_id = uuid6.uuid7() print(str(v7_id))
SQL (PostgreSQL & MySQL)
-- PostgreSQL UUID v4
SELECT gen_random_uuid();
-- PostgreSQL Table Schema with UUID v7
CREATE TABLE orders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), -- or uuid_generate_v7() extension
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- MySQL 8.0+
SELECT UUID();UUID Guides, Tutorials & Patterns
Explore our complete library of technical guides on UUID architecture, regex validation, and performance:
What Is a UUID? Meaning, Format & Examples
Detailed breakdown of UUID 128-bit structure, version comparisons, and database primary key performance.
UUID v4 vs. UUID v1: Which Should You Use?
Compare time-based v1 with random v4: MAC address security risks, indexing trade-offs, and modern v7 alternatives.
UUID v4 Generator & Implementation Guide
In-depth look at cryptographically secure pseudo-random generation, bit-shifting layout, and bulk export.
UUID Regex Patterns & Validation
Production-tested regular expressions for validating UUID v1, v4, v7, and general GUID formats with hyphen options.
Frequently Asked Questions
What is the difference between UUID v4 and UUID v7?
UUID v4 consists of 122 cryptographically secure random bits, making it completely unpredictable and uniform across its entire space. UUID v7 (standardized in RFC 9562) begins with a 48-bit Unix millisecond timestamp followed by 74 random bits. This gives v7 natural chronological sortability while maintaining collision resistance.
Why is UUID v7 better for databases than UUID v4?
Because UUID v4 is purely random, inserting rows with v4 primary keys causes random page splits and heavy memory fragmentation in B-Tree database indexes (such as PostgreSQL or MySQL InnoDB). UUID v7 is monotonically increasing by creation time, allowing new rows to append near the end of the index tree like an auto-incrementing integer while remaining globally unique across distributed workers.
Can UUID v4 or v7 identifiers collide?
Mathematically, the probability of collision is non-zero but infinitesimally small. For UUID v4 (122 random bits), generating 1 billion UUIDs per second for 85 consecutive years yields only a 50% chance of a single duplicate. For UUID v7, values generated in different milliseconds cannot collide because their leading timestamp bits differ.
What is RFC 9562?
RFC 9562 is the official IETF standard published in 2024 that obsoletes RFC 4122. It formally specifies new time-sortable UUID versions, most notably UUID v6, UUID v7, and UUID v8, standardizing modern database-friendly identifier formats across the software industry.
Are these UUIDs generated using a cryptographically secure RNG?
Yes. This generator uses window.crypto.getRandomValues(), which pulls entropy from your operating system's cryptographic random pool (CSPRNG). No pseudorandom Math.random() is ever used.
Does the local benchmark represent all devices?
No. The benchmark measures only the execution speed of your current browser and CPU under its immediate workload. It provides educational performance context, not a universal guarantee.