What is a UUID? Complete Guide to Universally Unique Identifiers
What is a UUID? Complete Guide to Universally Unique Identifiers
Learn what UUIDs are, the different versions (v1-v7), when to use them, and how to generate them. Essential for distributed systems and databases.
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information in computer systems. The probability of generating duplicate UUIDs is practically zero.
Format
550e8400-e29b-41d4-a716-446655440000
A UUID has 32 hexadecimal digits, displayed in 5 groups separated by hyphens: 8-4-4-4-12.
UUID Versions
UUID v4 (Random) - Most Common
Generated using random or pseudo-random numbers. This is what you should use in most cases.
f47ac10b-58cc-4372-a567-0e02b2c3d479
UUID v1 (Time-based)
Based on timestamp and MAC address. Reveals when and where it was generated.
UUID v7 (Time-ordered) - Newest
Combines timestamp ordering with randomness. Great for database primary keys because they're sortable by creation time.
When to Use UUIDs
- Database primary keys - Especially in distributed systems
- Session identifiers - Unique per user session
- Correlation IDs - Tracing requests across microservices
- File names - Avoiding conflicts in uploads
- API idempotency keys - Preventing duplicate operations
UUID vs Auto-Increment ID
| Feature | UUID | Auto-Increment |
|---|---|---|
| Uniqueness | Global | Per-table |
| Predictability | Unpredictable | Sequential |
| Distributed | Works offline | Requires coordination |
| Size | 16 bytes | 4-8 bytes |
| Index performance | Slower (v4) | Faster |
Generate UUIDs Now
Use our free UUID Generator to generate random v4 UUIDs instantly. Bulk generate up to 100 at once!