Learn
What Is a UUID? Universally Unique Identifier Guide
A UUID (Universally Unique Identifier) is a 128-bit identifier formatted as 32 hexadecimal digits in 8-4-4-4-12 groups. UUID v4 uses random generation and is the most common choice for application IDs.
UUID Versions
v1: timestamp + MAC address. v4: random (most common). v5: SHA-1 hash of namespace + name. v7: timestamp + random (sortable, newer standard).
Format Example
550e8400-e29b-41d4-a716-446655440000 — 36 characters including hyphens, 128 bits of entropy for v4.
When to Use UUIDs
Database primary keys in distributed systems, session IDs, request tracing, file naming, and anywhere you need globally unique identifiers without a central allocator.
Frequently Asked Questions
Can UUIDs collide?
Theoretically yes, but UUID v4 collision probability is negligible (~1 in 10^36 for generating 1 billion UUIDs). Safe for virtually all applications.
UUID vs auto-increment ID?
Auto-increment is smaller and faster for indexing but reveals record count and requires a central database. UUIDs work across distributed systems and hide sequential information.