UUID v4 Generator
Generate version 4 UUIDs using random numbers. The most common type with 122 random bits.
Configuration
Generated UUIDs
Generate UUID version 4
Format
UUID v4 uses random numbers:
xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx
The 4 in the third group indicates version 4. The [89ab] in the fourth group is a variant indicator.
Structure
- Random bits: 122 bits of cryptographically secure random numbers
- Version: 4 bits set to 0100 (version 4)
- Variant: 2 bits set to 10 (RFC 4122 variant)
Worked example
A typical UUID v4:
550e8400-e29b-41d4-a716-446655440000
550e8400-e29b-4= random (with version 4 indicator)1d4-a716= random446655440000= random
Note the "4" in the third group showing version 4.
How to use
- Click "Generate" to create a new UUID v4
- Copy the result
- Repeat for multiple UUIDs
Random generation
UUID v4 uses 122 random bits:
- 32 bits: first group
- 16 bits: second group
- 12 bits: third group (plus 4 version bits)
- 14 bits: fourth group (plus 2 variant bits)
- 48 bits: fifth group
Advantages
- Truly random: No predictable pattern
- Privacy-safe: No information about the generator
- ** Cryptographically secure**: Hard to guess or reproduce
- No coordination needed: Each generation is independent
Disadvantages
- Not sortable: Random order makes chronological sorting impossible
- No metadata: Cannot determine when or where it was generated
- Collision risk: Theoretically possible, though extremely unlikely
Collision probability
With 122 random bits, the probability of collision is:
- 1 in 2^61 after 1 billion UUIDs
- 1 in 2^31 after 1 trillion UUIDs
- Effectively zero for practical applications
Common use cases
- Database primary keys
- Session IDs
- API tokens
- Temporary identifiers
- Any unique ID requirement
FAQ
Is UUID v4 truly unique? Practically yes. The collision probability is astronomically low.
How many UUIDs can I generate? Effectively unlimited. 2^122 possible values.
Can I predict the next UUID? No, v4 uses cryptographically secure random numbers.
Should I use v4 for security tokens? Yes, v4 is the standard for security tokens and session IDs.
What about sorting? v4 UUIDs cannot be sorted chronologically. Use v1 if you need ordering.
Are all v4 UUIDs valid? Yes, as long as the version and variant bits are set correctly.