What is a UUID?
A UUID (also called GUID on Windows) is a 128-bit identifier displayed as 32 hexadecimal characters divided into 5 groups: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. Example: 550e8400-e29b-41d4-a716-446655440000
UUID Versions
- UUID v1: Based on the current timestamp and MAC address. Uniqueness guaranteed by time.
- UUID v3: Generated from a namespace and name using MD5 hashing. Deterministic (same input = same UUID).
- UUID v4: Completely random. The most widely used version. 122 bits of randomness.
- UUID v5: Like v3 but uses SHA-1 hashing instead of MD5.
Why Use UUID v4?
UUID v4 is random and doesn't expose system information (unlike v1 which includes your MAC address). With 2^122 possible values (≈5.3 × 10^36), the probability of generating duplicate UUIDs is astronomically low — essentially zero for any realistic use case.
Common Uses for UUIDs
- Database primary keys: Distributed systems can generate IDs without a central sequence generator.
- API tokens and session IDs: Random UUIDs are harder to guess than sequential integers.
- File naming: Avoid filename conflicts when storing user uploads.
- Idempotency keys: Prevent duplicate API requests by including a unique key per operation.
How to Generate UUIDs Online
FAQ
Are UUIDs the same as GUIDs?
Yes — GUID (Globally Unique Identifier) is Microsoft's name for UUID. They follow the same RFC 4122 standard and are interchangeable.
UUID vs auto-increment integer: which should I use?
Auto-increment integers are smaller and faster for simple single-server databases. UUIDs are better for distributed systems, APIs, or when you don't want to expose sequential IDs (which can reveal record counts to users).