A GUID and a UUID hold the same 128 bits and print as the same 36-character string. Microsoft calls it a GUID because COM needed a name. The RFCs call it a UUID. If naming were the whole story, this page would end here.
It is not the whole story. Each name carries its own conventions, and one of those conventions has quietly corrupted more databases than any typo. That convention is byte order.
The string itself
Five groups of hex digits: 8, 4, 4, 4, 12. The version sits in the first nibble of the third group, which tells you how the value was generated. Version 4 means random. Version 7 means a millisecond timestamp followed by randomness. Version 3 and 5 means a hash of a name.
The variant sits at the start of the fourth group and should be 8, 9, a or b. Plenty of strings match the shape and fail this check. A validator that only looks at hyphens will pass garbage.
Five formats, one value
.NET exposes five ways to print the same bytes.
| Format | Output |
|---|---|
N |
32 hex digits, no hyphens |
D |
lowercase, hyphenated (the default) |
B |
braces around D |
P |
parentheses around D |
X |
XML style, braces with urn:uuid: |
COM and the Windows registry store the B form. JSON APIs and URLs want the D form. A UUID in a URL path with braces needs percent-encoding, and half the routers on the internet will mangle it. Store lowercase hyphenated. Parse whatever arrives, then normalize before comparing.
Where the two names stop agreeing
new Guid(byte[]) does not read a byte array the way an RFC parser does. It takes the first four bytes as a little-endian int, the next two as a little-endian short, the next two as another short, and copies the final eight bytes untouched.
Feed it RFC-ordered bytes and the first three groups come back reversed at byte level:
var bytes = new byte[] { 0x01,0x23,0x45,0x67, 0x89,0xab, 0xcd,0xef,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 };
new Guid(bytes).ToString();
// 67452301-ab89-efcd-1011-121314151617
Compare that with the RFC string for the same bytes, 01234567-89ab-cdef-1011-121314151617. Different identifiers, same array. If one system stores BINARY(16) filled by PostgreSQL and another treats it as uniqueidentifier, the two systems disagree about which row they are pointing at, and nothing logs an error.
The safe habit: exchange the textual form between platforms, or use an explicit RFC-compatible converter. Skip the byte constructor unless you know which endianness it expects.
NEWID() and the index it ruins
SQL Server ships two generators. NEWID() returns random values, so every insert lands in a random page of the clustered index. On a busy table that means page splits, fragmentation, and a write path that gets slower as the table grows.
NEWSEQUENTIALID() returns increasing values and appends to the rightmost page instead. The catch: it only works inside a DEFAULT constraint and it leaks creation order.
If IDs must exist before the insert (offline clients, sharded writers), generate v7 in the application. A v7 value stored in a uniqueidentifier column keeps the ordering property, because both schemes sort by time at the byte level.
A short checklist
Pick one output format and use it everywhere. Normalize on input: strip braces, lowercase the hex. Convert through strings when crossing between Microsoft and non-Microsoft systems. And check the variant nibble when validating, rather than the hyphens alone.
Generate test values with the UUID generator, inspect an existing one with the UUID decoder, or run structural checks through the UUID validator.