What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit value used to uniquely identify information in computer systems. UUIDs follow the format:
550e8400-e29b-41d4-a716-446655440000
That's 32 hexadecimal digits displayed in five groups separated by hyphens: 8-4-4-4-12.
GUID (Globally Unique Identifier) is Microsoft's term for the same thing. UUID and GUID are functionally identical.
UUID Versions
UUID v1 - Time-based
Generated from the current timestamp and the device's MAC address. Guarantees uniqueness but exposes the creation time and hardware identity.
Use when: You need sortable, time-ordered IDs and privacy isn't a concern.
UUID v4 - Random
Generated from cryptographically random numbers. The most widely used version - no information leakage, no coordination needed.
Use when: You need unique IDs with no metadata exposure (most applications).
UUID v5 - Name-based (SHA-1)
Generated by hashing a namespace UUID + name string with SHA-1. The same inputs always produce the same UUID - making it deterministic.
Use when: You need reproducible IDs from known inputs (e.g., converting URLs to UUIDs).
How Unique Are UUIDs?
UUID v4 has 122 random bits, producing 5.3 × 10³⁶ possible values. To have a 50% chance of a collision, you'd need to generate approximately 2.71 × 10¹⁸ UUIDs - that's 2.71 quintillion.
For context: if you generated 1 billion UUIDs per second, it would take about 85 years to reach a 50% collision probability.
UUID vs Auto-Increment IDs
| Feature | UUID | Auto-Increment |
|---|---|---|
| Uniqueness scope | Global | Single database |
| Merging databases | ✅ No conflicts | ❌ ID collisions |
| Predictability | ✅ Opaque | ❌ Sequential (security risk) |
| Size | 16 bytes | 4-8 bytes |
| Index performance | ❌ Random = fragmented | ✅ Sequential = fast |
| Readability | ❌ Long hex string | ✅ Simple number |
Best Practices
- Use UUID v4 for most applications - it's simple, random, and has no metadata leakage
- Store as binary(16) in databases - not as a 36-character string (saves 56% storage)
- Use UUID v7 for sortable IDs - the newer RFC 9562 introduces time-ordered UUIDs optimised for database indexing
- Don't rely on UUIDs for security - they're unique, not secret. Use cryptographic tokens for auth.
- Consider ULID or NanoID - for shorter, URL-friendly identifiers
Generate UUIDs
Try our UUID Generator to generate v1, v4, and v5 UUIDs instantly in your browser with batch generation support.

