Developer Tools for Random Data Generation // v2.13.1
root@generate-random:~/uuid-v4$ _

Random UUID v4 Generator

Generate random UUID version 4 identifiers using cryptographic randomness - the most widely used UUID format for general-purpose unique identifiers

Our UUID v4 generator creates purely random universally unique identifiers using cryptographically secure random number generation per RFC 4122 standards. Generate UUID version 4 with 122 random bits for maximum unpredictability and uniqueness. Perfect for database primary keys, API tokens, session identifiers, transaction IDs, and any application requiring random unique identifiers without timestamp or MAC address exposure. Most widely adopted UUID version across modern systems and programming languages.

What is UUID v4?

UUID v4 (Universally Unique Identifier version 4) is a randomly generated identifier defined in RFC 4122 that uses cryptographically secure random number generation to produce 128-bit unique identifiers. Unlike other UUID versions, v4 contains no meaningful information - no timestamps, no MAC addresses, no namespace hashing - just 122 bits of pure randomness (6 bits are reserved for version and variant indicators). This makes v4 the most privacy-friendly UUID version and the de facto standard for general-purpose unique identifier generation in modern software development.

The format follows the standard 32 hexadecimal digits in 5 groups: 8-4-4-4-12 (e.g., 550e8400-e29b-41d4-a716-446655440000). The version field (4) indicates random generation, while variant bits ensure RFC 4122 compliance. With 2^122 possible values (5.3×10^36), collision probability is astronomically low - you could generate a billion UUIDs per second for 100 years and have less than 50% chance of a single collision. UUID v4 is universally supported across databases (PostgreSQL, MySQL, MongoDB), programming languages (Java, Python, JavaScript, Go), and cloud platforms, making it the safest choice for new projects requiring unique identifiers without special ordering or determinism requirements.

UUID v4 Generator Configuration

Quantity (1-100 UUIDs)

Generate multiple UUID v4 identifiers simultaneously using cryptographically secure random number generation. Each UUID is completely independent with 122 random bits, ensuring astronomical uniqueness probability across all generated identifiers.

Cryptographic Randomness

All UUIDs use cryptographically secure pseudo-random number generators (CSPRNG) ensuring unpredictability and security. Unlike pseudo-random generators, CSPRNG provides randomness suitable for security-sensitive applications.

RFC 4122 Compliance

Generated UUIDs strictly follow RFC 4122 specification with proper version bits (0100) and variant bits (10xx). Ensures compatibility with all UUID-aware systems, databases, and programming language libraries.

Export Formats

Export generated UUIDs as plain text (TXT), comma-separated values (CSV), or JSON with metadata for seamless integration into databases, API responses, configuration files, test data, and application code.

How to Generate UUID v4

[STEP 1] Set Quantity

Choose how many UUID v4 identifiers to generate (1-100). Each UUID is independently generated using cryptographically secure randomness, ensuring uniqueness across all identifiers.

[STEP 2] Generate Instantly

Click EXECUTE GENERATION to create random UUIDs. Generation is instant and uses CSPRNG for maximum unpredictability and security. No configuration needed - v4 is purely random with no parameters.

[STEP 3] Copy & Use

Click individual UUIDs to copy them instantly, or use export buttons to download all UUIDs as TXT, CSV, or JSON for database insertion, API integration, or application development.

[STEP 4] Implement

Use UUID v4 for database primary keys, session IDs, API tokens, transaction identifiers, file names, cache keys, or any scenario requiring unique, unpredictable identifiers without timestamp or ordering requirements.

UUID v4 Best Practices

  • _ General Purpose Default - UUID v4 is the safest choice for most applications. Use it as your default unless you specifically need time-based sortability (v7) or deterministic generation (v3/v5).
  • _ Privacy Friendly - Unlike v1, UUID v4 exposes no MAC addresses or timestamps. Perfect for user-facing identifiers, public APIs, and privacy-sensitive applications.
  • _ Database Indexing - While v4 lacks sortability, its randomness prevents index hotspots in distributed databases. For time-series data requiring ordered IDs, consider v7 instead.
  • _ Collision Probability - With proper CSPRNG, collision risk is negligible (2^122 possible values). However, always use database unique constraints as defense-in-depth.
  • _ API and Tokens - Ideal for session tokens, API keys, OAuth states, and CSRF tokens where unpredictability is crucial. Random nature prevents prediction attacks.
  • _ Testing and Development - UUID v4 is perfect for test data and development environments. For deterministic test fixtures requiring reproducible IDs, use v3 or v5 instead.

Technical Implementation

UUID v4 follows RFC 4122 specification, using cryptographically secure random number generation to produce 128-bit identifiers:

// UUID v4 Structure (128 bits total)
Algorithm: Random UUID Generation (CSPRNG)

// Step 1: Generate 128 random bits
random_bytes = CSPRNG(16 bytes / 128 bits)

// Step 2: Set version bits (bits 48-51 = 0100)
random_bytes[6] = (random_bytes[6] & 0x0F) | 0x40

// Step 3: Set variant bits (bits 64-65 = 10)
random_bytes[8] = (random_bytes[8] & 0x3F) | 0x80

// Bit Allocation:
Random bits: 122 bits (maximum entropy)
Version bits: 4 bits (value = 4 = 0100)
Variant bits: 2 bits (value = 10 for RFC 4122)

// Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
// where y ∈ {8, 9, a, b} (variant bits)
Example: 550e8400-e29b-41d4-a716-446655440000

Collision Probability: 1 in 2^122 ≈ 5.3×10^36

API Access for Developers

Generate UUID v4 identifiers programmatically using our free REST API. No authentication required for basic usage.
GET https://generate-random.org/api/v1/generate/uuids?version=4&count=10
VIEW FULL API DOCUMENTATION

Frequently Asked Questions

Why is UUID v4 the most popular version?
UUID v4 is the most widely used because it's simple, privacy-friendly, and universally supported. Unlike v1 (exposes MAC addresses and timestamps) or v3/v5 (requires namespace configuration), v4 requires no parameters - just generate and use. Its pure randomness ensures no information leakage, making it ideal for public-facing identifiers, APIs, and security tokens. The cryptographic randomness provides astronomical uniqueness probability without complexity.
What are the chances of UUID v4 collision?
UUID v4 collision probability is astronomically low. With 122 random bits, there are 5.3×10^36 possible UUIDs. To have a 50% chance of a single collision, you'd need to generate 2.71×10^18 UUIDs (2.71 quintillion). Generating a billion UUIDs per second would take 86 years to reach 50% collision probability. In practice, database errors and hardware failures are far more likely than UUID v4 collisions.
Can I use UUID v4 for database primary keys?
Yes! UUID v4 is excellent for database primary keys, especially in distributed systems where multiple servers generate IDs independently without coordination. However, v4's randomness can cause index fragmentation in some databases. For time-series data or applications prioritizing database write performance, consider UUID v7 which combines randomness with time-based sorting for better index locality while maintaining unpredictability.
Is UUID v4 secure enough for authentication tokens?
UUID v4 provides good randomness (122 bits) suitable for session identifiers and CSRF tokens when generated using CSPRNG. However, for high-security tokens like API keys, OAuth tokens, or cryptographic keys, use dedicated token generation with 128+ bits of entropy or established standards like JWT. UUID v4 is cryptographically random but was designed for uniqueness, not security. Always use HTTPS for token transmission.
Should I use UUID v4 or v7 for new projects?
For general-purpose identifiers: UUID v4 (simple, proven, universally supported). For database-heavy applications with time-series data: UUID v7 (better index performance due to timestamp-based sorting). For APIs and distributed systems: v4 (no timestamp correlation, better privacy). For maximum compatibility with existing systems: v4 (most widely adopted). UUID v7 is newer (2024 RFC) with excellent properties but less ecosystem support currently.