Toolhast

UUID and GUID Generator Online

Free online UUID and GUID generator: generate random RFC 4122 version 4 UUIDs instantly in bulk or single. 100% private in-browser with zero tracking.

100% Client-Side Entropy:Generated with hardware Web Crypto API CSPRNG. Never transmitted over the internet.
RFC 4122 v4•122-Bit Cryptographic Randomness
Format & Style ControlsApplied instantly to generated UUIDs
Quotes:
RFC 4122 Version 4 UUID
Generating...
Version4 (CSPRNG Random)
VariantRFC 4122 (10xx)
Bit Length128 bits (16 bytes)
Entropy122 random bits

The Engineering Guide to UUIDs, GUIDs, RFC 4122, and Distributed Identifiers

In modern computing, distributed systems require a robust method to generate unique identifiers across independent database nodes, microservices, mobile clients, and cloud instances without central lock synchronization or single points of failure. The solution standardized across the software engineering industry is the Universally Unique Identifier (UUID), formalized by the Internet Engineering Task Force (IETF) in RFC 4122 and later updated in RFC 9562.

Whether you are generating primary keys for a high-throughput PostgreSQL database, designing RESTful API resources, provisioning Microsoft COM components, or issuing session tokens, understanding the architecture, entropy mathematics, and performance trade-offs of UUIDs is critical for software architects and full-stack developers.

1. Anatomy of a UUID: The 128-Bit Hexadecimal Structure

A UUID is fundamentally a 128-bit integer (16 octets or bytes). In textual representation, it is displayed as a canonical 36-character string containing 32 hexadecimal digits grouped into five hyphen-separated segments:

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

Each group has specific historical and technical definitions under RFC 4122:

  • Time-Low (8 hex characters, 32 bits): Positions 1 to 8 (e.g., c9a646d3).
  • Time-Mid (4 hex characters, 16 bits): Positions 10 to 13 (e.g., 9c61).
  • Version and Time-High (4 hex characters, 16 bits): Positions 15 to 18 (e.g., 4cb7). The first character (M) denotes the UUID Version. For a Version 4 UUID, this character is always 4.
  • Variant and Clock-Seq (4 hex characters, 16 bits): Positions 20 to 23 (e.g., bf7d). The first character (N) encodes the UUID Variant. In RFC 4122, the two most significant bits are set to 10, which means N can only be one of four hex digits: 8, 9, a, or b.
  • Node (12 hex characters, 48 bits): Positions 25 to 36 (e.g., 1f1c9d56). In Version 1, this contained the machine's MAC address; in Version 4, all 48 bits are generated from cryptographic random data.

2. Comparison of UUID Versions: From v1 to v7

RFC standards define multiple UUID versions, each tailored for different operational constraints:

VersionBasis / Generation MechanismPrimary Use CaseKey Drawback
UUID v1Gregorian timestamp (100ns intervals) + Node MAC addressLegacy distributed systems requiring time orderingLeaks machine MAC address and exact creation timestamp (privacy flaw)
UUID v3MD5 hash of a namespace UUID and arbitrary stringDeterministic identifier generation from textMD5 is cryptographically broken and vulnerable to collision attacks
UUID v4Cryptographically secure pseudo-random bytes (CSPRNG)Modern web APIs, primary keys, session tokens, distributed appsRandom distribution causes B-Tree index fragmentation in large tables
UUID v5SHA-1 hash of a namespace UUID and input stringDeterministic namespace-based identifiersSlower to compute; deterministic nature unsuitable for random secret tokens
UUID v7Unix millisecond timestamp + 74 bits of random entropyModern database primary keys (PostgreSQL, MySQL, SQLite)Recently finalized in RFC 9562; older libraries may lack native parsing

3. The Mathematics of UUID v4 Collision Resistance

A Version 4 UUID reserves 4 bits for the version number (0100) and 2 bits for the RFC 4122 variant (10xx). Subtracting these 6 fixed bits from the total 128 bits leaves 122 bits of true entropy.

The total number of possible UUID v4 values is:

2122 ≈ 5.3 × 1036 (5.3 undecillion combinations)

To understand this scale in practical terms, calculate the collision probability using the Birthday Problem approximation formula:

p ≈ n2 / (2 × 2122)

Even if your application generates 1 billion UUIDs per second for an entire year (approximately 3.15 × 1016 UUIDs), the probability of generating a single collision is less than 0.0000000000000001 (one in one quadrillion). This statistical guarantee allows distributed systems to generate keys locally without checking a central database.

4. UUID vs Auto-Incrementing IDs in Database Design

When architecting database tables in relational engines like PostgreSQL, MySQL, or SQL Server, developers frequently weigh auto-incrementing sequential integers (BIGSERIAL or IDENTITY) against UUIDs:

  • Security & Enumeration Prevention: Sequential IDs allow malicious users and competitors to scrape resources by incrementing numbers (e.g., /orders/1001 to /orders/1002), revealing your total transaction volume and customer count. UUID v4 obscures internal database state completely.
  • Client-Side ID Provisioning: In offline-first apps or microservice architectures, clients (such as mobile devices) can generate valid UUID primary keys locally before sending data to the server, enabling atomic multi-table inserts without round-trip ID lookups.
  • Merge & Replication Simplicity: Merging records from two separate database shards or multi-tenant instances with integer IDs causes catastrophic key collisions. UUIDs guarantee global uniqueness across all shards.
  • Storage & Index Considerations: Standard UUIDs require 16 bytes of binary storage (or 36 bytes if stored inefficiently as VARCHAR), compared to 8 bytes for BIGINT. Furthermore, random UUID v4 values insert randomly across database B-Trees, causing page splits in clustered indexes. For clustered primary keys, consider using sequential UUID v7 or storing UUIDs in native binary types (e.g., PostgreSQL UUID or MySQL BINARY(16)).

5. Why Web Crypto API CSPRNG is Mandatory

In early web development, poorly written JavaScript libraries constructed UUIDs using Math.random():

// UNSAFE ANTI-PATTERN: Never use Math.random() for UUIDs
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => ...)

Math.random() is not a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG). Browsers implement Math.random() with lightweight algorithms like xoshiro128+ or XorShift, designed for speed in gaming and graphics rather than security. An attacker who observes several consecutive generated values can reconstruct the PRNG's internal state and predict past and future UUIDs, completely compromising API authentication tokens or session IDs.

Toolhast exclusively utilizes native browser CSPRNG APIs:

// SECURE NATIVE BROWSER CSPRNG:
crypto.randomUUID() // Built into modern browsers (RFC 4122 v4)
crypto.getRandomValues(new Uint8Array(16)) // Hardware entropy backed

These native methods tap directly into operating system entropy pools (such as /dev/urandom on Linux/macOS and CryptGenRandom / CNG on Windows), guaranteeing non-deterministic, cryptographically resilient identifiers for production software systems.

How to generate and validate UUIDs and GUIDs online

  1. Select your generation mode: Instant Single UUID, Bulk Generator (up to 1,000 UUIDs), or UUID Validator & Inspector.

  2. Customize your formatting options: toggle uppercase or lowercase, standard hyphens (36 chars) vs compact hex (32 chars), or Microsoft GUID curly braces.

  3. Choose your bulk delimiter: newline, comma, semicolon, or JSON array format for direct inclusion in code or SQL scripts.

  4. Click 'Copy UUID' or 'Copy All' to copy immediately to your clipboard, or click 'Download' to save as a .txt or .json file.

Examples

Input
Default RFC 4122 v4 Generation (36-character canonical format)
Output
c9a646d3-9c61-4cb7-bf7d-b2d61f1c9d56

Contains 32 hexadecimal digits separated by four hyphens with version 4 (nibble '4') and variant 10xx (nibble 'b').

Input
Microsoft GUID format with braces and uppercase letters
Output
{6B29FC40-CA47-1067-B31D-00DD010662DA}

Commonly required in C#, .NET Entity Framework, Windows Registry keys, and COM interfaces.

Frequently asked questions

What is a UUID and how does Version 4 work?

A Universally Unique Identifier (UUID) is a 128-bit label used to uniquely identify resources across distributed systems without central coordination. Version 4 UUIDs rely purely on cryptographic pseudo-random number generation. Out of 128 bits, 6 bits designate version and variant, leaving 122 bits of pure entropy for virtually zero collision risk.

What is the difference between a UUID and a GUID?

UUID (Universally Unique Identifier) and GUID (Globally Unique Identifier) refer to the exact same 128-bit identification standard defined in RFC 4122. Microsoft coined the term GUID for its Component Object Model (COM) and .NET architectures, typically formatting them with uppercase letters and surrounding curly braces, while UUID is the open IETF standard.

What are the odds of two UUID v4 values colliding?

The probability of generating duplicate UUID v4 values is astronomically tiny due to 122 bits of true entropy. You would need to generate one billion UUIDs every second for approximately 36 years to achieve a 50% chance of a single collision, making duplicate keys statistically impossible in real-world database architectures.

Why is Math.random() insecure for generating UUIDs?

Standard `Math.random()` relies on pseudo-random number generators (PRNG) like xoshiro128+, which are deterministic, seed-dependent, and predictable by attackers. Toolhast exclusively uses the Web Crypto API (`crypto.getRandomValues` and `crypto.randomUUID`), which interfaces directly with your operating system hardware entropy pool to supply cryptographically secure randomness essential for security tokens and primary keys.

Should I use UUIDs or auto-incrementing IDs in databases?

Auto-incrementing integers provide compact indexing and natural temporal sorting, but expose business metrics to scrapers and fail across distributed multi-master databases. UUID v4 prevents enumeration attacks and allows client-side ID generation before database writes, though random inserts can cause B-tree index fragmentation compared to sequential identifiers like UUID v7.

Are generated UUIDs stored or tracked on any server?

No. Toolhast executes all UUID generation and validation entirely within your browser sandbox via native Web Crypto APIs. None of your generated UUIDs, configuration options, or validated keys are transmitted over the internet, sent to analytics, or stored in remote database records, ensuring total developer privacy and confidentiality.

  • JSON Formatter & Validator

    Free online JSON formatter, validator, and minifier: beautify messy JSON, fix errors, and minify code instantly. 100% private in-browser with zero uploads.

  • Base64 Encoder & Decoder

    Free online Base64 encoder and decoder: encode and decode text or files to Base64 with UTF-8 support. 100% private in-browser with zero server uploads.

  • URL Encoder & Decoder

    Free online URL encoder and decoder: encode and decode URLs and URI query parameters with UTF-8 percent-encoding. 100% private in-browser with zero uploads.

Browse all developer tools tools

Private: this tool runs in your browser. Nothing you type is uploaded.

Last updated