Dev Explained

UUID and GUID Explained: What They Are and Why They're Random

If you've ever seen an ID like f47ac10b-58cc-4372-a567-0e02b2c3d479 attached to a file, a database record, or an order confirmation, you've run into a UUID.

What a UUID actually is

UUID stands for Universally Unique Identifier. It's a 128-bit number, almost always written as 32 hexadecimal characters split into five groups by dashes, used to label something, a file, a database record, a session, a device, in a way that's extremely unlikely to ever collide with another ID generated anywhere else, by anyone else, at any other time. GUID, short for Globally Unique Identifier, is Microsoft's own name for essentially the same concept. In practice, the two terms get used interchangeably, and a guid generator and a uuid generator almost always produce the exact same kind of value.

Why not just count 1, 2, 3

Simple incrementing numbers work fine when a single system is entirely in control of assigning them. The moment you have multiple databases, multiple servers, or offline devices that need to generate IDs independently without checking in with each other first, sequential numbers fall apart, since two different sources can easily assign the same number to two different things. A UUID solves this by being random enough that any two systems generating IDs completely independently, without ever communicating, still won't produce the same value in any realistic scenario. That property is exactly what makes UUIDs useful across distributed systems, offline-first apps, and merging data from separate sources without worrying about ID clashes.

How unlikely is a collision, actually

A standard random UUID has enough possible combinations that you could generate billions of them every second for centuries and still have a vanishingly small chance of ever generating the same one twice. This is why UUIDs are trusted as unique identifiers without needing a central authority to check and approve each one before it's used, unlike something like a username, which does need to be checked against existing ones.

What "UUID4" and the version number actually mean

UUIDs come in a few different versions, and the number after the word UUID refers to how it was generated. UUID version 4, which is what most people mean when they ask for a uuid4 generator or simply a random UUID, is generated using random or pseudo-random data alone. Older versions, like version 1, incorporate the generating device's network information and the current timestamp, which technically makes them unique too, but can leak details about when and where the ID was created. Because of that, version 4 is the practical default for the vast majority of everyday use cases, which is exactly why nearly every modern uuid generator produces version 4 values unless you specifically ask for something else.

Where UUIDs actually show up

  • Primary keys in databases, especially ones spread across multiple servers.
  • Session identifiers and API keys, since they're unpredictable and hard to guess.
  • File names for uploads, avoiding collisions when many users upload files with the same original name.
  • Tracking individual requests or transactions through a system for debugging and logging.
  • Uniquely identifying devices, installations, or configuration entries.

What a UUID looks like, and how to read it

A standard UUID looks like this: f47ac10b-58cc-4372-a567-0e02b2c3d479. It's 32 hexadecimal characters, arranged in five groups separated by dashes, in the pattern 8-4-4-4-12. One small but occasionally useful detail: in a version 4 UUID, the first character of the third group is always the digit 4, which is how you can visually confirm you're looking at a version 4 UUID rather than another version, without needing any special tool.

Generate a UUID online, without writing any code

You don't need to write a single line of code to get a valid UUID. Modern browsers can generate cryptographically random UUIDs natively, which is exactly what a good online UUID generator relies on behind the scenes, meaning the value is generated instantly and privately on your own device rather than being requested from somewhere else.

You can try this directly with the free UUID / GUID generator on this site. Generate a single ID or up to a hundred at once, with options to switch to uppercase or remove the dashes if your project expects a different format, all processed locally in your browser.

A few things beginners often get wrong

  • Assuming a UUID guarantees absolute uniqueness. It's astronomically unlikely to collide, not mathematically impossible, though for practical purposes that distinction essentially never matters.
  • Using an older, timestamp-based UUID version when a random version 4 UUID would have been simpler and more private.
  • Treating a UUID as a security measure by itself. It's unpredictable, which makes it hard to guess, but it isn't the same as encryption or authentication.
  • Manually typing or editing a UUID by hand, which is exactly how a stray character error creeps in. Generating and copying it directly avoids that entirely.

The bottom line

A UUID, or GUID under Microsoft's naming, is simply a long random value designed to be unique enough that no two systems generating one independently will ever realistically produce the same result. That's the whole idea, no central coordination required, no collisions to worry about in practice. Whenever you need an ID that just works without a database checking it first, a random UUID is almost always the simplest, safest choice.

Frequently asked questions

What is a UUID, and is it the same as a GUID?

A UUID is a 128-bit identifier written as 32 hexadecimal characters in five groups. GUID is the name Microsoft uses for the same thing.

Can two UUIDs ever be the same?

In theory yes, in practice no. For randomly generated version 4 UUIDs, the chance of a collision is so small that it is ignored in real systems.

What does UUID version 4 mean?

Version 4 means the UUID is built from random data rather than from your device or the current time. It is the version most modern systems use.

Why use a UUID instead of an auto-incrementing ID?

UUIDs can be created anywhere without checking a central counter, and they are hard to guess. Auto-incrementing IDs are shorter and simpler but reveal how many records exist and need one place to hand out numbers.