Guides · 2026-04-29
What Is a UUID, and When Should You Use One?
A clear explanation of UUIDs (GUIDs) — what they are, why they're unique, the different versions, and when to use them in your projects.
If you've worked with databases, APIs, or file systems, you've seen strings like 3f2504e0-4f89-41d3-9a0c-0305e82c3301. That's a UUID — and it solves a surprisingly hard problem: how do you create an identifier that's guaranteed to be unique without asking a central authority?
What a UUID actually is
A UUID (Universally Unique Identifier), also called a GUID (Globally Unique Identifier) in the Microsoft world, is a 128-bit number, usually written as 32 hexadecimal digits in five groups: 8-4-4-4-12. That's it — a very large number, formatted for readability.
Why they're effectively unique
The most common type, version 4, is generated almost entirely from random bits — 122 of them. The number of possible values is so astronomically large (billions of billions of billions) that if you generated a billion UUIDs per second for a century, the odds of ever seeing a duplicate would still be negligible. That means two different computers, with no coordination between them, can each mint UUIDs and safely assume they'll never collide.
The main versions
- v4 (random): the everyday choice — simple, unpredictable, no metadata leaked. This is what our UUID Generator produces.
- v1 (time-based): derived from timestamp and machine info; sortable but can reveal when/where it was made.
- v7 (time-ordered): a newer version that's both random and roughly sortable by creation time — increasingly popular for database keys.
When to use a UUID
- Database primary keys when you want to generate IDs on the client or across many services without a central counter.
- Distributed systems where multiple servers create records independently.
- File names and upload IDs to avoid collisions and make guessing hard.
- Idempotency keys so retried API requests aren't processed twice.
When not to bother
For a short, human-facing code (like an order number a customer reads over the phone), a UUID is overkill and unfriendly. Use a shorter scheme there. UUIDs shine when uniqueness matters more than readability.
Generate one instantly
Open the free UUID Generator to create a single v4 UUID or a batch of them, computed in your browser with cryptographic randomness — nothing is uploaded.