🆔
← Back to Guides

What Is a UUID? A Complete Guide to Universally Unique Identifiers

· Tags: uuid, guid, database, primary-key, uuid-v7

A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information. The probability of generating the same UUID twice using v4 is astronomically low — roughly 1 in 2^122 for a collision after generating 2.71×10^18 UUIDs.

UUID Structure

550e8400-e29b-41d4-a716-446655440000
|------||----||--||----||----------|
 time    time  ver  var    node
 low      mid

The version nibble (character 13) indicates the generation algorithm: 1 for v1, 4 for v4, 7 for v7.

UUID vs Auto-Increment

| Feature | Auto-Increment | UUID v4 | UUID v7 | |---------|---------------|---------|---------| | Uniqueness | Single DB | Global | Global | | Sortability | Yes | No | Yes | | Guessability | High | None | Very low | | Distributed | Hard | Easy | Easy | | Index performance | Best | Poor (B-tree fragmentation) | Good (time-sortable) |

For distributed systems or when you need IDs generated client-side, UUIDs are the standard choice. Generate them with our free UUID generator.