What Is a UUID, and Why Is It Everywhere?

Open almost any modern app's database or API and you'll find long strings like f47ac10b-58cc-4372-a567-0e02b2c3d479 used as identifiers. These are UUIDs, and they solve a surprisingly deep problem: how do you give millions of things unique names when no single authority hands out the numbers? This guide explains what a UUID is, why it works, and when you'd want one.

The problem UUIDs solve

Imagine you're building an app. Every user, order and photo needs a unique ID. The obvious approach is counting: user 1, user 2, user 3. This works fine when one database assigns the numbers. But modern systems are distributed — data is created on phones that are offline, on multiple servers at once, across different data centres. If two servers both hand out "order 500" at the same moment, you have a collision and a corrupted system.

You could have every server ask a central counter for the next number, but that central point becomes a bottleneck and a single point of failure. What you really want is a way for anyone, anywhere, to generate an identifier that is essentially guaranteed to be unique — without coordinating with anyone else. That's exactly what a UUID provides.

What a UUID looks like

A UUID (Universally Unique Identifier — also called a GUID in Microsoft's world) is a 128-bit value, usually written as 32 hexadecimal characters split into five groups by hyphens, like f47ac10b-58cc-4372-a567-0e02b2c3d479. That's a fixed, recognisable shape. The hyphens are just for readability; the value is the 128 bits.

Why they're practically unique

Here's the part that feels like magic. The most common type, version 4, is almost entirely random — 122 of its 128 bits are random. The number of possible version-4 UUIDs is around 5 followed by 36 zeros. That quantity is so vast it's hard to convey. A common way to put it: you would have to generate billions of UUIDs every second for around a hundred years before you'd have even a tiny chance of a single collision.

So UUIDs aren't guaranteed unique in a mathematical sense — two random ones could theoretically match — but the probability is so astronomically small that, in practice, everyone treats them as unique. That's the trade the design makes: give up an absolute guarantee in exchange for the ability to generate IDs anywhere, instantly, with no coordination.

The different versions

Not all UUIDs are made the same way, and the "version" (the digit at the start of the third group) tells you how:

When to use one

Reach for a UUID whenever you need an identifier and can't (or don't want to) rely on a central counter:

When not to use one: UUIDs are long and not human-friendly, so they're a poor fit for anything a person has to read out, type, or remember — order confirmation codes, coupon codes, URLs meant to be shared verbally. There, a shorter, friendlier code is better even if it needs a central generator.

UUIDs are not secrets

One important caution: a UUID being hard to guess does not make it a security token. A version-4 UUID is random enough that it's impractical to guess, so people sometimes use one as an unguessable link. That can be acceptable for low-stakes "secret URLs", but UUIDs aren't designed as credentials — they can end up in logs, browser history and analytics. For anything that genuinely needs to be secret, use a purpose-built secret or token, and a strong password generator for passwords.

Key takeaways

Advertisement

Tools mentioned in this guide

Password Generator

Create strong, random passwords with a real strength meter.

Generators

UUID Generator

Generate random version 4 UUIDs in bulk.

Developer Tools

Hash Generator

Generate MD5, SHA-1, SHA-256 and SHA-512 hashes.

Developer Tools