Every way to write the same UUID

UUID text8 sectionsUpdated

The 128 bits never change; the punctuation does. Canonical, bare hex, braces, urn:uuid and upper case are five spellings of one identifier, and comparing two of them as strings is a bug.

Half the identifier bugs that reach production are spelling mismatches: a braced GUID from a registry export compared with a canonical one from an API. This page lists every form the tool reads and writes, and says who expects each.

UUID textcomputed by the converter itself
inf81d4fae-7dec-11d0-a765-00a0c91e6bf6out{f81d4fae-7dec-11d0-a765-00a0c91e6bf6}

.NET calls this format B

in01890a5d-ac96-774b-bcce-b302099a8057out{01890a5d-ac96-774b-bcce-b302099a8057}

A v7 — punctuation does not touch the version nibble

Open the converter: UUID textNothing you paste leaves the browser.
On this page (8)

The five spellings#

SpellingThe same identifierWhere it is expected
plainf81d4fae-7dec-11d0-a765-00a0c91e6bf6The canonical form. What RFC 9562 writes and what every parser accepts.
hexf81d4fae7dec11d0a76500a0c91e6bf6.NET format N. What a CHAR(32) column and most cache keys hold.
braces{f81d4fae-7dec-11d0-a765-00a0c91e6bf6}.NET format B. The Windows registry and COM write this.
urnurn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6A valid URN, for XML, RDF and anything that needs a URI.
upper caseF81D4FAE-7DEC-11D0-A765-00A0C91E6BF6Case is not significant; Windows tools write capitals.

The converter reads all of them, in any case, and writes whichever you pick. Nothing in this table changes a single bit.

RFC 9562 § 4 · UUID FormatThe text form the standard defines, and what a reader must accept

The .NET format letters#

LetterLooks likeSame as
N32 digits, no punctuationthe hex spelling above
D8-4-4-4-12 with hyphensthe canonical spelling
Bhyphenated, in bracesthe braces spelling
Phyphenated, in parenthesesa variant of braces this tool does not write
Xa C struct literal: {0x…,0x…,0x…,{0x…}}four fields, not a text form

The X format is the odd one: it is a C initialiser for the Windows GUID struct, and its first three fields are little-endian. That makes it a byte-order question rather than a spelling question.

urn:uuid, and when a UUID must be a URI#

XML, RDF and other systems that identify things by URI need a scheme in front. urn:uuid: was registered for exactly that, so urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6 is a valid URN naming the same identifier. Strip the prefix and it is an ordinary UUID again.

RFC 4122 § 3 · Namespace Registration TemplateWhere the urn:uuid namespace was first registered; RFC 9562 section 7 points that registration at itself

Case, and the comparison bug#

RFC 9562 writes UUIDs in lower case and requires readers to accept both cases. Windows writes capitals. Two spellings of one identifier are not equal as strings, so normalise on input, to lower case and without hyphens if you store bare hex, and compare the normalised form. A database that stores both forms in the same column will eventually return duplicate rows for one entity.

Which to store#

ColumnBytes per rowReadable in a query result
native uuid type16yes, the driver formats it
BINARY(16)16no, unless you wrap it
CHAR(32) bare hex32yes
CHAR(36) canonical36yes
braced or urn form38 or 45yes, and nobody thanks you

Questions people actually ask#

Is a braced GUID a different value?

No. Braces, hyphens, the urn: prefix and letter case are all punctuation. The identifier is the 32 hex digits.

What is the .NET N format?

32 hex digits with no hyphens, the same thing as the hex spelling in the table above.

Should I store UUIDs upper or lower case?

Lower case, and normalise on the way in. The standard writes lower case, and mixed case in one column produces duplicate rows for one entity.

Browse the reference