UUID vs GUID explained
Published by InstantToolDeck · Updated November 2026
A UUID (universally unique identifier) is a 128-bit value used to label things without asking a central authority for a number. A GUID (globally unique identifier) is simply Microsoft’s name for the same thing. If you see either in a database, API or config file, it looks like 123e4567-e89b-12d3-a456-426614174000: 32 hex digits in groups of 8-4-4-4-12.
Versions
| Version | How it is made | Good for | Watch out for |
|---|---|---|---|
| v1 | Timestamp plus a machine identifier | Sortable by creation time | Can reveal when and where it was created |
| v4 | Random bits | General purpose, the common default | Random order hurts some database indexes |
| v5 | Hash of a namespace and a name | Same input always gives the same ID | Not random, so not for secrets |
| v7 | Unix time in milliseconds plus random bits | Time-ordered IDs, friendly to indexes | Newer, so older libraries may lack it |
Version 7 was standardized in RFC 9562 (2024). The UUID Generator creates v4 and v7 values in your browser, and the GUID Generator is preset for the Microsoft naming.
How likely is a collision?
A v4 UUID has 122 random bits. By the birthday paradox you would need to generate roughly 2.7 quintillion (2.7×1018) of them before the chance of any duplicate reaches 50 percent. If you create a billion per second, that takes about 85 years. For normal applications collisions are not a practical concern, provided the random numbers come from a proper source such as the browser’s crypto API, which our tools use.
Databases and performance
Random v4 values inserted into a large indexed table land in random places, causing page splits and a bloated index. Time-ordered v7 values append near the end, behaving much like an auto-incrementing key while keeping global uniqueness. Where the database supports it, store UUIDs in a native 16-byte type instead of a 36-character string, which saves space and speeds up comparisons.
UUIDs are identifiers, not secrets
A v4 UUID is hard to guess, but do not use one as a password, reset token or API key unless it comes from a cryptographically secure source and you treat it like a secret. For secrets, use a long random string from the password generator. If you want to prove data has not changed, a hash is the right tool, not an identifier.
Format details
- Letter case does not matter; lowercase is conventional, while Microsoft tools often show uppercase.
- Windows registry and some APIs wrap the value in braces:
{123E4567-E89B-12D3-A456-426614174000}. - The hyphens are optional in many systems, giving a 32-character string.
- The first digit of the third group shows the version (4 in v4) and the first digit of the fourth group shows the variant.
Generating one in code
JavaScript: crypto.randomUUID(). Python: uuid.uuid4(). C#: Guid.NewGuid(). PowerShell: [guid]::NewGuid(). SQL Server: NEWID(). PostgreSQL: gen_random_uuid().
Frequently asked questions
Is a GUID the same as a UUID?
Yes. GUID is Microsoft’s term for the same 128-bit identifier format.
Which UUID version should I use?
Use v4 for general identifiers and v7 when the IDs are database keys and you want them roughly ordered by time.
Can two UUIDs ever be the same?
In theory yes, in practice almost never. You would need to create billions per second for decades to have a realistic chance.
Should I use a UUID as a secret token?
Only if it comes from a cryptographically secure generator and you treat it as a secret. A longer random string is better.