A UUID looks like a random string of letters, digits and hyphens, but every character sits in a deliberate position. Once you know the layout, you can read one group by group: which version it is, whether it follows the standard variant, and whether a value you have been handed is even shaped correctly.
This guide walks through the format using the values produced by the UUID Generator on Ovatly, which creates version 4 UUIDs in canonical form.
Contents
- Quick answer
- The five groups, one by one
- The version digit: the 4 in group three
- The variant position: y in group four
- Why lowercase with hyphens is the canonical form
- Braces, uppercase and other spellings
- Worked example: dissecting a real value
- Limitations of reading the format
- Common mistakes
- FAQs
- Conclusion
Quick answer
A UUID is a 128-bit value written as 32 hexadecimal digits, split by hyphens into five groups of 8, 4, 4, 4 and 12 digits: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. In a version 4 UUID, the first digit of the third group is always 4 (the version marker), and the first digit of the fourth group (the y position) is always one of 8, 9, a or b (the variant marker). The other 122 bits are random. The canonical written form is lowercase with hyphens, the form the UUID Generator returns.
The five groups, one by one
Count the characters in any UUID and you get 36: 32 hexadecimal digits and 4 hyphens. Hexadecimal digits run from 0 to 9 and then a to f, sixteen possible values per position. The hyphens divide the value into five groups with fixed sizes:
- Group 1: 8 digits.
- Group 2: 4 digits.
- Group 3: 4 digits. Carries the version marker in its first position.
- Group 4: 4 digits. Carries the variant marker in its first position.
- Group 5: 12 digits.
In version 4, the groups are simply filled with random bits apart from the two fixed markers. The shape stays the same across versions; only the meaning of the bits changes.
The version digit: the 4 in group three
The most useful character in a UUID is the first digit of the third group: it records the version, the scheme used to fill the bits. A 4 there means the value was generated randomly, with no timestamp and no machine address encoded in it. Other digits mark other schemes, such as 1 for the time-based layout.
This gives you a fast sanity check. If someone hands you a UUID and claims it came from a random generator, look at the first digit after the second hyphen. If it is not 4, the claim or the value is wrong. The generator on this page creates version 4 only, so every value it produces passes that check by construction.
The variant position: y in group four
The first digit of the fourth group is called the variant position, written as y in the pattern. The variant describes which layout family the UUID follows. For the standard layout, that digit is always one of 8, 9, a or b. In binary terms, the top bits of that digit are fixed to a pattern that says "standard variant", which is why four different digits can appear there.
Together, the version and variant markers explain the gap between 128 total bits and 122 random bits. Six bits are spent on bookkeeping: four on the version, and the variant takes its share from the y position. Everything else is chosen at random by the generator's cryptographic random source.
Why lowercase with hyphens is the canonical form
The canonical form is lowercase hexadecimal digits with hyphens between the groups, exactly as the generator returns it. A single agreed spelling matters because systems compare identifiers constantly, and it removes a whole class of bugs. A database storing the lowercase form will not match an uppercase query in a raw text comparison. An API that validates input with a strict pattern may reject a value with no hyphens even though the digits are identical.
Most databases and APIs expect this form, so generated values can be pasted straight into a seed script, a fixture file or an API request without reformatting.
Braces, uppercase and other spellings
The same 128-bit value shows up in other costumes, and recognising them saves confusion:
- Uppercase. Some systems, especially older Microsoft tooling, print UUIDs in capital letters. The value is unchanged; hexadecimal is case-insensitive. It only becomes a problem when a strict parser or case-sensitive comparison expects lowercase.
- Braces. You will see values wrapped like
{xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx}in Windows registry entries and some Microsoft documentation. The braces are a container, not part of the identifier. - No hyphens. A 32-digit run with no separators is the same digits in compact spelling. Some token and key formats use it; most UUID columns and validators want the hyphens back.
None of these spellings changes the underlying number or the version and variant markers. What changes is whether the receiving system accepts that spelling. When in doubt, convert back to lowercase with hyphens.
Worked example: dissecting a real value
Take a generated value that follows the pattern:
3f8a2c1e-9b4d-4e7a-a5c2-1d6f8b0e2a47
Read it in four checks. First, the shape: five groups of 8, 4, 4, 4 and 12 digits, 32 digits and 4 hyphens in total, so it is the right size for a UUID. Second, the third group is 4e7a, starting with 4, so this is a version 4 value: random, with nothing about time or machine encoded in it. Third, the fourth group is a5c2, starting with a, one of the four allowed variant digits, so it follows the standard variant. Fourth, the spelling: lowercase with hyphens, the canonical form, ready to paste into a database or an API call.
That is the full reading: shape, version, variant and spelling, confirmed in seconds using nothing but the layout.
Limitations of reading the format
The format tells you how a value was made, not whether it is trustworthy or appropriate. A well-formed UUID can still be the wrong identifier for a row, and a version 4 value is an identifier, not a credential: for API keys or passwords, prefer a longer password from this site's Password Generator, with more entropy and control over the character set.
Nor can reading the format recover lost information: version 4 values encode nothing, so there is no timestamp or origin hidden in the digits to extract. And because generated values are never stored by the tool, a batch you did not copy is gone. Finally, if you need identifiers that sort by creation time, random version 4 values will not do it; look at UUID v7 in a dedicated library instead.
Common mistakes
- Counting the hyphens as part of the value. A UUID is 32 digits; the written form is 36 characters only because of the 4 separators.
- Checking the wrong position for the version. The version digit starts the third group, not the first. A value starting with 4 means nothing by itself.
- Assuming uppercase means a different ID. Case does not change the number, but a case-sensitive comparison can fail to match it, so normalise to lowercase before comparing as text.
- Stripping hyphens to "clean up" a value. Some parsers accept the compact form; many do not. Keep the canonical spelling unless the receiving system asks otherwise.
- Pasting a braced value into an API. Braces belong to registry-style displays. Remove them and use the plain hyphenated form.
FAQs
How many characters are in a UUID? 36 characters in the written form: 32 hexadecimal digits plus 4 hyphens. The groups hold 8, 4, 4, 4 and 12 digits, which adds up to the full 128-bit value.
How can I tell a UUID is version 4? Look at the first digit of the third group. In a version 4 UUID it is always 4. The first digit of the fourth group is one of 8, 9, a or b, which marks the standard variant.
Are uppercase UUIDs and lowercase UUIDs the same value? Yes. Hexadecimal digits are case-insensitive, so both spellings name the same 128-bit number. Some parsers and string comparisons are strict, though, which is why the lowercase canonical form is the safe default.
What do the braces around some UUIDs mean? Braces are a wrapping convention used by some Microsoft tools and registries. The value inside is the same UUID. Most APIs and databases expect the plain hyphenated form.
How many of the bits in a version 4 UUID are random? 122 of the 128 bits are random. The rest are spent on fixed markers: the version digit and the variant bits. That randomness is why accidental duplicates are treated as a non-event.
Conclusion
The 8-4-4-4-12 pattern turns a UUID from a blur of characters into a readable structure: five groups, a version digit you can check at a glance, a variant digit from a set of four, and a canonical lowercase spelling that databases and APIs accept without reformatting. The UUID Generator produces exactly that form, one value or a batch at a time. The other half of the job is producing values in bulk when a project needs them, the subject of the companion guide on generating UUIDs for test data and fixtures.
Related guide: How to Generate UUIDs for Test Data and Fixtures.
More tools for this kind of work live in the Developer Tools archive.