What Is a UUID? Version 4 vs Version 7 Explained
By Durim Hoti · Last updated
UUIDs (universally unique identifiers) let any computer create an ID without asking a central server, with practically no risk of two IDs colliding. That makes them common as database keys, file names and request IDs. The current standard is RFC 9562 (2024), which added version 7.
How to read a UUID
550e8400-e29b-41d4-a716-446655440000
^ ^
| variant: 8, 9, a or b = RFC 9562
version: 4
01a2217d-75c0-7025-b358-7da2c7ec1136
└─────┬─────┘ ^
timestamp version: 7
(milliseconds since 1970)The 13th hex digit is always the version, and the 17th digit shows the variant (8, 9, a or b for standard UUIDs). Everything else is random in v4. In v7, the first 48 bits are the time in milliseconds since 1 January 1970 (UTC), followed by random bits.
Generate and check UUIDs step by step
- Open the UUID generator.
- Choose v4 random or v7 time-ordered and set How many.
- Optional: Uppercase, No hyphens or {Braces}. With all three, a UUID looks like
{01A2217D75C07025B3587DA2C7EC1136}. - Click Generate, then Copy all or Download .txt.
- Paste any UUID under Validate a UUID to see its version, variant and canonical form.
Example: v7 UUIDs sort by time
We generated three v7 UUIDs with a fixed clock: two in the same millisecond (28 November 2026, 09:30:00.000 UTC) and one a millisecond later.
01a2217d-75c0-7025-b358-7da2c7ec1136
01a2217d-75c0-7026-be63-88add2f71c41
01a2217d-75c1-7146-9479-9ec3e80d3257Sorted as plain text, they stay in the order they were created. Inside one millisecond, a counter in the next digits keeps them in order (…7025, …7026). Random v4 UUIDs such as 550e8400-e29b-41d4-a716-446655440000 have no such order.

Common problems
The validator says the UUID is invalid
We checked two typical typos:
550e8400-e29b-41d4-a716-44665544000g: A UUID has 32 hexadecimal digits (0–9, a–f), usually written as 8-4-4-4-12.550e8400e-29b-41d4-a716-446655440000: The hyphens are in the wrong place; the format is 8-4-4-4-12.
Uppercase, braces or no hyphens
All describe the same UUID. The validator accepts braces, a urn:uuid: prefix and missing hyphens, and shows the canonical lowercase form.
v4 keys make my database slow to insert
Random keys land at random places in an index. If that becomes a problem, switch new records to v7; both versions fit the same 128-bit column type.
The creation time of a v7 UUID looks wrong
The time comes from the clock of the device that created it, in UTC. A wrong device clock gives a wrong time.
What to do next
UUIDs often travel in JSON; if a payload won't parse, see how to fix JSON errors. For another encoding you meet in APIs, see what Base64 is.
FAQ
- Can two UUIDs ever be the same?
- In theory yes, in practice no. A v4 UUID has 122 random bits; you would need to create about 2.7 quintillion (2.7 × 10^18) of them for a 50 % chance of a single duplicate. v7 UUIDs add a timestamp, so duplicates would have to happen in the same millisecond.
- Should I use UUID v4 or v7 as a database key?
- v7 is usually the better choice for primary keys: new IDs sort after older ones, so they are added at the end of an index instead of at random places. Use v4 when the ID must not reveal when it was created.
- Is a GUID the same as a UUID?
- Yes. GUID is Microsoft's name for the same 128-bit format. GUIDs are often written in uppercase and in braces, like {550E8400-E29B-41D4-A716-446655440000}; the validator accepts that.
- Does a v7 UUID reveal when it was created?
- Yes. The first 12 hex digits are the creation time in milliseconds. The validator shows it as a date. Don't use v7 where that time is sensitive.
- Are the generated UUIDs random enough?
- They use the browser's cryptographic random number generator (crypto.getRandomValues, and crypto.randomUUID for v4 where available), and are generated on your device.
Try it and keep reading
- Open the UUID generatorGenerate UUID v4 and v7 in bulk and validate UUIDs.
- What Is Base64? How Encoding Works, with ExamplesSee how Base64 turns 3 bytes into 4 characters, what padding means, and when to use it.
- How to Fix JSON Errors Like "Unexpected token"Understand JSON error messages, find the exact spot, and fix the nine most common mistakes.