A UUID — Universally Unique Identifier, sometimes called a GUID — is a 128-bit value used to label something without a central authority handing out numbers. A UUID generator lets any service, on any machine, create an identifier that is effectively certain to be unique, which is why UUIDs are everywhere in modern software.
The format
A UUID is written as 32 hexadecimal digits in five groups separated by hyphens, following an 8-4-4-12 pattern:
That is 36 characters in total, including the four hyphens. The digits are hexadecimal, so each one represents four bits, and 32 of them make up the full 128-bit value.
Version 1 vs version 4
Version 1 builds the identifier from a timestamp and the machine's network address, so v1 UUIDs are roughly time-ordered but can leak when and where they were created. Version 4 is almost entirely random. Version 4 is the most common choice today because it needs no special inputs and reveals nothing about its origin.
Are collisions possible?
In theory, yes; in practice, no. A version 4 UUID draws from 122 random bits, giving so many possible values that generating them at scale for many years still leaves the odds of a repeat vanishingly small. For everyday applications you can treat them as unique.
Where UUIDs are used
- Database primary keys, so records can be created without coordinating a shared counter.
- Distributed systems, where many services mint IDs independently.
- Idempotency keys that let an API safely retry a request without duplicating it.
- File names, session tokens, and correlation IDs in logs.
How to use the generator online
- Open the generator to produce a UUID instantly.
- Generate more, or a batch, if you need several.
- Copy the value into your database, code, or config.
FAQ
Q: What is the difference between v1 and v4?
A: Version 1 encodes a timestamp and machine address and is time-ordered; version 4 is random and reveals nothing about its source. Most applications use v4.
Q: Are UUIDs truly unique?
A: Not guaranteed in the strict mathematical sense, but the collision probability is so tiny that they are treated as unique in practice.
Q: Can I use a UUID as a database primary key?
A: Yes. It is a common pattern; just be aware that random v4 keys can affect index locality compared with sequential integers.