What Is a UUID and When Do You Need One?
Related tool
UUID Generator
A UUID (Universally Unique Identifier) is a 128-bit value, usually written as 32 hex characters split into five groups, like 3f2504e0-4f89-11d3-9a0c-0305e82c3301. What makes it useful isn't the format — it's that any system, anywhere, can generate one without asking a central authority whether it's already taken.
Why not just use 1, 2, 3...?
An auto-incrementing integer ID only works because a single database is the one source of truth handing out the next number in sequence. That breaks down the moment more than one system needs to create IDs independently — two servers, an offline mobile app syncing later, or merging data from two databases that both started counting from 1. A UUID sidesteps the problem entirely: it's generated locally, and the odds of two different UUIDs colliding are astronomically small.
The version that matters most: UUIDv4
There are several UUID versions, but v4 is what you'll encounter almost everywhere by default — it's generated from random (or pseudo-random) bits, with no dependency on the current time, a MAC address, or any external state. That randomness is exactly what makes it safe to generate on totally disconnected systems and still avoid collisions.
When you actually need one
- Distributed systems — multiple services or servers creating records independently, with no shared counter
- Offline-first apps — a mobile app that creates records while offline and syncs them later needs IDs that won't collide with anything created elsewhere in the meantime
- Public-facing IDs — an auto-increment ID in a URL (
/orders/1042) leaks how many records exist and makes IDs guessable; a UUID doesn't - Merging data sources — combining records from separate databases without ID collisions
When a plain integer is still the better choice
If you have a single database as the source of truth, don't need to hide the record count, and want the smallest, fastest-to-index primary key, an auto-incrementing integer is simpler and takes up less storage than a UUID's 128 bits. UUIDs solve a specific problem — they're not a default upgrade for every table.
Need one right now? Our UUID Generator creates random v4 UUIDs in your browser, one click at a time.