- Home
- Tools
- Generators
- UUID Generator
- GUID Generator
GUID Generator
Random GUIDs in the form Windows writes them, uppercase and in braces. Switch either off for the form SQL Server or .NET uses.
Random from start to end. The usual choice.
GUID is Microsoft's word for UUID
A GUID, "globally unique identifier", is the same 128-bit number that the rest of the world calls a UUID. Windows, .NET and SQL Server say GUID; the standard and most other platforms say UUID. A value made here is valid as both.
What differs is the way the same value gets written down:
| Where you meet it | What it looks like |
|---|---|
| Windows registry, Visual Studio solution files | {3F2504E0-4F89-41D3-9A0C-0305E82C3301} |
| SQL Server, for instance from NEWID() | 3F2504E0-4F89-41D3-9A0C-0305E82C3301 |
| .NET, Guid.ToString() | 3f2504e0-4f89-41d3-9a0c-0305e82c3301 |
| .NET, Guid.ToString("N") | 3f2504e04f8941d39a0c0305e82c3301 |
This page opens in the first form. Untick In braces for the second, untick Uppercase as well for the third, and tick Without hyphens on top of that for the last. All four spell the same GUID: upper and lower case make no difference, and Guid.Parse in .NET reads every one of them.
What Guid.NewGuid() makes
The GUIDs that .NET hands out with Guid.NewGuid() are version 4: random, apart from the six bits that mark the version and the layout. You can tell by the first digit of the third group, which is a 4, exactly as in the GUIDs on this page. Since .NET 9 there is also Guid.CreateVersion7(), for GUIDs that sort by the time they were made. Choose Version 7 above for those.
Where it goes wrong: bytes
As text, a GUID is the same everywhere. The 16 bytes behind it are not. Guid.ToByteArray() in .NET returns the first three groups with their bytes in reverse order, a leftover of how Windows has always stored them. Pass a GUID from one system to another as text and nothing can happen. Pass it as raw bytes, and the first half comes out scrambled unless both sides use the same order.
The other versions, the nil UUID and the inspector are explained on the UUID generator page.