ModernUUID Icon ModernUUID
RFC 4122 / RFC 9562 STANDARD

UUID v4 Generator (Cryptographic Random)

Version 4 UUIDs utilize 122 bits of unguessable random entropy generated directly from modern OS hardware interfaces, making them ideal for universally unique database keys, distributed microservices, and secure session tokens.

Select Identifier Architecture
RFC 4122 / 9562 STANDARD

Online UUID Version 4 Generator Tool

Cryptographically random universal identifier generated using modern browser hardware entropy.

Generated Output:
Generatingโ€ฆ
Formatting & Manipulation Options

Architecture and Mathematical Foundation of UUID Version 4

Standard Reference: IETF RFC 4122 ยง4.4 / RFC 9562 ยง5.4

Structural Bit Layout (128 Bits Total)

A Universally Unique Identifier (UUID) Version 4 is a 128-bit integer rendered as 32 hexadecimal characters separated into five groups by four hyphens: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

8 Hex Digits 32 bits random

time_low segment populated purely with CSPRNG entropy.

4 Hex Digits 16 bits random

time_mid segment filled with random hardware bytes.

4 Hex (0x4...) 4b Version + 12b rand

First nibble is fixed at binary 0100 (Version 4).

4 Hex (0x8..B) 2b Variant + 14b rand

First nibble is masked to 10xx (RFC 4122 variant).

12 Hex Digits 48 bits random

node field replaced entirely with random cryptographic bytes.

Collision Probability & Mathematical Security

Because 6 of the 128 total bits are dedicated to standard metadata (4 version bits and 2 variant bits), exactly 122 bits consist of unconstrained, hardware-seeded cryptographic randomness. The total pool of possible Version 4 UUID combinations is:

2122 = 5,316,911,983,139,663,491,615,158,242,912,644,112 โ‰ˆ 5.31 ร— 1036

According to the cryptographic Birthday Paradox, the probability $P$ of encountering at least one collision after generating $n$ unique Version 4 UUIDs is approximated by:

P(n) โ‰ˆ 1 - e-nยฒ / (2 ร— 2ยนยฒยฒ)
UUIDs Generated Collision Probability Real-World Comparative Scale
1 Billion (10โน) โ‰ˆ 1 in 10ยฒโท (0.0000000000000000000000001%) Virtually zero; lower odds than being struck by lightning 10 times in a single day.
1 Trillion (10ยนยฒ) โ‰ˆ 1 in 10ยฒยน Exceeds the total number of transactions processed across global financial networks annually.
2.71 Quintillion (2.71 ร— 10ยนโธ) โ‰ˆ 50% (Statistical Threshold) Generating 1 billion UUIDs per second continuously for 85 consecutive years.

When to Deploy UUID v4 vs. UUID v7

โœ… When to use UUID v4

  • Stateless Security Tokens: Password reset tokens, session tokens, and webhook secrets where unpredictable entropy prevents brute-force enumeration.
  • Anti-Enumeration IDs: Public-facing resource identifiers where leaking creation timestamps (such as in UUID v7) exposes business telemetry.
  • In-Memory Distributed Maps: Ephemeral task IDs and event message correlations.

โš ๏ธ When to consider UUID v7 instead

  • SQL Database Primary Keys: High-throughput PostgreSQL, MySQL, or SQLite tables where random v4 inserts trigger B-Tree index page splits.
  • Time-Ordered Logs: Event audit logs where natural chronological sorting optimizes range scan performance.
๐Ÿš€ HIGH-SPEED BATCH

Bulk Identifier Generation

Generate up to 50,000 unique identifiers simultaneously. Export instantly to Plain Text (`.txt`), JSON Arrays (`.json`), or CSV Column (`.csv`).

items
Previewing generated batch: 10 generated
Developer FAQ & Technical Reference

Frequently Asked Questions

Deep technical explanations covering identifier architecture, token security, cryptographic hashing, and zero-backend client execution.

UUIDs & Identifiers

RFC 9562 & NanoID
01. What is a UUID and what does UUID stand for? +

UUID stands for Universally Unique Identifier (often used interchangeably with GUID, or Globally Unique Identifier). It is a standardized 128-bit algorithmic label formatted as a 36-character hexadecimal string separated by hyphens (e.g., 550e8400-e29b-41d4-a716-446655440000).

As standardized under RFC 9562 (which supersedes RFC 4122), UUIDs empower distributed systems, microservices, and databases to generate uniquely identifying primary keys locally without requiring network synchronization, consensus verification, or a centralized identifier generation authority.

02. What is the difference between UUID v4 and UUID v7? +

The core architectural difference lies in randomness versus time-sortability:

  • UUID v4 is purely pseudo-random, relying entirely on 122 bits of cryptographically secure pseudo-random number generator (CSPRNG) entropy. While completely unpredictable, inserting random v4 keys into relational database engines causes severe B-tree index fragmentation and page splits at massive scales.
  • UUID v7 introduces a revolutionary time-sequential format. It encodes a 48-bit UNIX millisecond timestamp in the most significant bits, followed by monotonic sequence counters and random entropy.

Engineering Recommendation: Deploy UUID v7 for relational database primary keys (PostgreSQL, MySQL, CockroachDB) to maintain lightning-fast chronological B-tree insert indexing, and deploy UUID v4 for transient session authentication IDs, secure bearer tokens, or API secret keys where unpredictability is essential.

03. Can UUIDs collide? Is a UUID completely unique? +

In theoretical mathematics, yes; in practical engineering reality, no. A UUID v4 contains 122 bits of independent entropic variance, creating a total keyspace of 2122 (approx. 5.3 ร— 1036, or 5.3 undecillion) possible combinations.

According to the cryptographic birthday paradox, a system would need to generate approximately 2.71 quintillion UUIDs before reaching a modest 50% probability of a single collision occurring. When generated using hardware-backed operating system entropy (such as the browser native window.crypto.getRandomValues() interface utilized strictly by Modern UUID), cryptographic collision is considered mathematically negligible in production infrastructure.

04. What is a NanoID, and NanoID vs UUID: which is better? +

NanoID is an ultra-compact, URL-safe, high-speed unique identifier generation protocol. When evaluating NanoID vs UUID for architectural integration:

  • Payload Size & Alphabet: NanoID defaults to a concise 21-character representation by harnessing a larger 64-character alphabet (A-Za-z0-9_-). This renders NanoID ~40% smaller than a standard 36-character UUID string while guaranteeing identical cryptographic collision resistance.
  • Execution Performance: NanoID is optimized for rapid hardware memory allocation and CPU efficiency, making it ideal for high-frequency short link URL routing, JSON packet transmission compaction, and NoSQL document keys.
  • Standardization: UUID is explicitly governed by IETF specification protocols (RFC 9562), making it the universal choice for traditional SQL schemas, enterprise RPC contracts, and cross-language interoperability.

Ready to execute these cryptographic utilities locally?

Run multi-format UUID generators, JWT decoders, Bcrypt hashers, and Token synthesis engines inside your browser sandboxโ€”zero server latency, total anti-interception privacy.

Developer Knowledge & Standards

Specifications & Multi-Language Code Snippets.

Integrate UUID version 4, time-ordered version 7 (RFC 9562), and compact NanoIDs directly into your backend or frontend microservices with native, dependency-free code.

generator-snippets.ts
          
        

๐Ÿ“Š Identifier Architecture Matrix

Version Entropy / Logic Ideal Use Case
UUID v4 122 bits random General API keys & universal IDs.
UUID v7 48b time + 74b rand Database Primary Keys (B-Tree sort).
NanoID 126 bits (21 char) URL slugs & tight payloads.
UUID v3/5 MD5 / SHA-1 Hash Deterministic IDs from strings/URLs.
UUID v1 100ns time + MAC Legacy systems requiring MAC audit.
Why use UUID v7 over v4 for databases?

Standard random UUID v4 inserts cause random disk page I/O fragmentation in SQL indexes. Version 7 embeds a chronological millisecond timestamp in the top 48 bits, keeping index inserts naturally sequentially sorted!