← Back to Developer Tools
🔑

UUID v4 Generator — Cryptographically Random UUIDs

Generate v1, v3, v4, v5, v6, v7 UUIDs · Bulk export · Validate · Inspect · Batch check

💡

UUID v4 uses a cryptographically secure random number generator (CSPRNG via Web Crypto API) to produce 122 random bits. It is the most widely used UUID version — simple, stateless, and requires no coordination. This tool generates RFC 4122 compliant v4 UUIDs with bulk export up to 1000 at once.

Configuration
🎲 Cryptographically random — most common choice
1
Ctrl + Enter to generate
Output · Generated in 0.12ms
1fba27af-8963-46cd-b08d-6c91d023a48f
1 UUIDs36 chars0.04 KB
🎯 Collision Probability (v4) SAFE
< 1 in 10³⁰probability of collision in 1 UUID
UUID v4 has 2¹²² ≈ 5.3 × 10³⁶ possible values. At 1 UUIDs, collision risk is effectively zero.
Ctrl+Enter Generate/RunCtrl+Shift+C Copy OutputCtrl+L ClearCtrl+S DownloadH Toggle History

Frequently Asked Questions

How is UUID v4 generated?

UUID v4 uses 122 random bits from a cryptographically secure pseudo-random number generator (CSPRNG). The version nibble is set to 4 (bits 12–15 of the 7th byte) and the variant is set to RFC 4122 (bits 6–7 of the 9th byte set to 10). The remaining 122 bits are completely random.

What is the probability of a UUID v4 collision?

UUID v4 has 2¹²² ≈ 5.3 × 10³⁶ possible values. To have a 50% probability of any collision, you would need to generate approximately 2.7 × 10¹⁸ UUIDs — roughly 86 years at 1 billion UUIDs per second. For all practical applications, collision probability is effectively zero.

Is UUID v4 suitable for database primary keys?

UUID v4 works as a primary key but has a performance disadvantage — because it is fully random, each new UUID inserts randomly throughout the B-tree index, causing page splits and fragmentation. For high-insert-rate databases, UUID v7 is significantly better as it is time-ordered and appends to the end of the index.

Does this tool use crypto.randomUUID() for v4?

Yes — this tool uses the browser's native crypto.randomUUID() API which is available in all modern browsers (Chrome 92+, Firefox 95+, Safari 15.4+). For older browsers, it falls back to crypto.getRandomValues() with a manual UUID v4 construction — both methods are cryptographically secure.

Can I generate UUID v4 without hyphens?

Yes — enable the "No Hyphens" format option. The 32-character hex output (e.g., f47ac10b58cc4372a5670e02b2c3d479) is useful for compact database storage, URL parameters, or systems that do not support the hyphenated format natively.

What does the version number in UUID v4 look like?

In a v4 UUID like f47ac10b-58cc-4372-a567-0e02b2c3d479, the 13th character (position 14 with hyphens) is always "4" — indicating version 4. The 17th character (position 19 with hyphens) is always 8, 9, a, or b — indicating the RFC 4122 variant. Use the UUID Inspector in this tool to decode all fields.