UUID Generator

Generate v4 UUIDs

About This Calculator

A UUID (Universally Unique Identifier) is a 128-bit identifier formatted as 32 hex characters in groups of 8-4-4-4-12. Version 4 UUIDs are randomly generated, making collisions practically impossible — even generating a billion UUIDs per second for 100 years.

Formula

v4 format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
x = random hex digit; y = 8, 9, a, or b (variant bits)
Probability of collision with 1 billion UUIDs ≈ 1 in 1 billion billion

Example Calculation

Example UUID v4

  1. Generate 122 random bits
  2. Set version bits to 0100 (4) and variant bits
  3. Format as 8-4-4-4-12 hex groups
550e8400-e29b-41d4-a716-446655440000

UUID Versions

VersionGeneration MethodCommon Use Case
v1Time-based + MAC addressDistributed systems needing time ordering
v3MD5 hash of namespace+nameDeterministic IDs from known inputs
v4RandomGeneral-purpose unique IDs (most common)
v5SHA-1 hash of namespace+nameDeterministic IDs (safer than v3)

Frequently Asked Questions

Is it safe to use UUID as a primary key in a database?
Yes, but with trade-offs. UUIDs prevent ID enumeration attacks and work well in distributed systems. However, random v4 UUIDs cause index fragmentation. Consider UUID v7 (time-ordered) or sequential UUIDs for better database performance.
Are two UUIDs ever the same?
Theoretically possible but practically impossible. With v4 UUIDs, you would need to generate about 2.7 quintillion UUIDs before having even a 50% chance of one collision (the birthday paradox threshold).
What is the difference between UUID and GUID?
GUID (Globally Unique Identifier) is Microsoft's term for UUID. They follow the same RFC 4122 standard and are interchangeable. The terms are used in different technology ecosystems but refer to the same concept.