Skip to main content

UUID Version 4 Generator

UUIDv4 • Cryptographically Random
00000000-0000-0000-0000-000000000000
Enclose:

Generate Bulk UUIDs

Max 5,000
Formatting & Structure

Ready

No batch active
Industry StandardRFC 9562 Section 5.4 / RFC 4122

UUID Version 4 Technical Specification (RFC 4122 & RFC 9562)

UUIDv4 is the most widely utilized UUID version across modern computer systems. Out of its 128 total bits, exactly 122 bits are filled with cryptographically secure random entropy, while 6 bits are reserved for standard version (0100) and variant (10xx) metadata.

Bitfield Layout & Binary Structure

Detailed 128-bit byte distribution according to RFC standards.

Field NameBit RangePurpose & Description
random_hi48 bits (0-47)Cryptographically secure pseudorandom entropy.
ver4 bits (48-51)Constant binary value 0100 (identifies Version 4).
random_mid12 bits (52-63)Cryptographically secure pseudorandom entropy.
var2 bits (64-65)Constant binary value 10 (RFC standard variant).
random_lo62 bits (66-127)Cryptographically secure pseudorandom entropy.

Advantages & Strengths

  • Maximum privacy: leaks zero timestamp, MAC address, domain, or sequencer information.
  • Universally supported by every programming language standard library and database engine.
  • Unpredictable by design, making it immune to enumeration attacks or IDOR guessing.
!

Considerations & Trade-offs

  • Poor B-Tree clustering performance: completely random writes cause severe index page splits.
  • Cannot be sorted chronologically without an auxiliary created_at column.

Best Recommended For

  • Session tokens, API keys, password reset tokens, and OAuth authorization codes.
  • Unpredictable user-facing identifiers where privacy and non-enumerable IDs are required.
  • Non-indexed document keys and distributed caches (Redis, Memcached).

When to Avoid

  • High-throughput database primary keys in clustered B-Tree indexes (use UUIDv7 instead).
  • Chronological log sequences where lexicographic sorting is required.

Code Implementation Examples

Native Web CryptoJavaScript / TypeScript
// Modern browsers and Node.js 14.17+
const id = crypto.randomUUID();
console.log(id); // e.g. "c9a646d3-9c61-4cc9-bc0c-930438cf38cf"
Python Standard LibraryPython
import uuid

id = uuid.uuid4()
print(id) # e.g. "f47ac10b-58cc-4372-a567-0e02b2c3d479"
Go (google/uuid)Go
package main

import (
  "fmt"
  "github.com/google/uuid"
)

func main() {
  id := uuid.New()
  fmt.Println(id.String())
}

Frequently Asked Questions

How many random UUIDv4 values are possible?
UUIDv4 provides 122 bits of random entropy, which equals 2^122 or approximately 5.3 × 10^36 unique combinations. Generating a duplicate has odds of less than one in a billion even producing 1 billion IDs per second for 85 consecutive years.
Does UUIDv4 use Math.random()?
No. Our generator uses crypto.getRandomValues() via the Web Crypto API, which draws entropy directly from the OS kernel CSPRNG (/dev/urandom or Windows BCryptGenRandom), ensuring true cryptographic randomness.