What Is a UUID, and Why Does It Matter?
Developer Tools - 5 min read - Published 2026-08-27
A UUID (Universally Unique Identifier) is a 128-bit value, usually written as 32 hexadecimal characters split into five groups by hyphens, like 550e8400-e29b-41d4-a716-446655440000. The point of a UUID is that it can be generated independently, on any machine, with no coordination with any other system, and still be safe to assume it won't collide with any other UUID ever generated.
Why This Matters More Than It Sounds
Traditional auto-incrementing database IDs (1, 2, 3...) require a central authority - the database - to hand out the next number, which is a problem the moment you have multiple servers, offline-capable apps, or distributed systems generating records independently. Two different servers can't both safely claim "row 47" without coordinating first. UUIDs sidestep this entirely: any client, anywhere, can generate a UUID for a new record before it ever talks to a server, with a probability of collision that's effectively zero in practice.
Version 4: The Random One
There are several UUID versions, but version 4 - fully random - is what most modern systems use by default, including the browser's built-in crypto.randomUUID(). Of its 128 bits, 122 are random; the remaining 6 are fixed to identify it as a version-4 UUID. With that much randomness, the odds of two independently generated v4 UUIDs colliding are astronomically small - you'd need to generate roughly a billion UUIDs per second for about 85 years before there's a 50% chance of a single collision.
When You'd Actually Use One
UUIDs show up as primary keys in distributed databases, request IDs for tracing a single request across microservices, session tokens, and any identifier that needs to be generated client-side before the server has seen it. They're not always the right choice - they're larger than integer IDs and don't sort chronologically the way auto-incrementing IDs do - but for anything that needs guaranteed uniqueness without central coordination, they're the standard tool.