GUID generator — random GUIDs in .NET B, D, N, P and X formats

Choose one of the five .NET formats and the tool makes up to 500 random version 4 GUIDs, ready to paste into the Windows registry, a C# file, a SQL script or a config file.

Live demo · real result from this tool

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the GUID generator

  1. Pick a Format: Registry / .NET “B” (with braces), .NET “D” (no braces), .NET “N” (32 digits, no hyphens), .NET “P” (in parentheses) or .NET “X” (C# struct initialiser).
  2. Leave Uppercase ticked for Windows-style capitals, or untick it for lowercase.
  3. Set How many GUIDs, from 1 to 500 (5 by default), and press Generate.
  4. Copy one value or the whole list.

What it does and when to use it

Windows and .NET use GUIDs everywhere: COM class and interface IDs, registry keys, MSI product and upgrade codes, Visual Studio project IDs, and primary keys in SQL Server tables (uniqueidentifier). Each place tends to expect one particular spelling. Picking the right format here saves you from adding braces or stripping hyphens by hand.

The five formats match what Guid.ToString("B"), ("D"), ("N"), ("P") and ("X") produce in .NET:

Format Shape
B {xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx}
D xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
N 32 hex digits, no separators
P (xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)
X {0x…,0x…,0x…,{0x…,0x…,0x…,0x…,0x…,0x…,0x…,0x…}}

If you need options beyond these, such as time-ordered version 7 IDs, use the UUID generator. For shorter IDs in URLs, the Nano ID generator is a better fit.

How it works

Each GUID starts as 16 random bytes from crypto.getRandomValues. The tool then sets six fixed bits: the version digit becomes 4 (the first digit of the third group), and the variant bits make the first digit of the fourth group 8, 9, A or B. That leaves 122 random bits. The X format splits the same 32 hex digits into one 8-digit, two 4-digit and eight 2-digit parts.

Worked examples

  • C# struct form. Format X, Uppercase off, one GUID. The output looks like {0xcd343f7c,0x5dde,0x4aaa,{0xa9,0xf7,0xe5,0xd5,0x30,0xee,0xca,0x9d}}. The inner ,{0x before the last eight bytes is always there.
  • Spotting the version. In every X-format GUID the third part starts with 0x4, the version 4 marker. In the B, D and P formats the same 4 starts the third group.
  • Registry style. Format B with the defaults gives values such as {FCD5EED0-FF5B-4992-8356-EEE8931EE8A2}.

Limits and tips

  • These are random IDs, not sequential ones. In a clustered SQL Server index, random keys can cause page splits; consider NEWSEQUENTIALID() or ULIDs if insert speed matters.
  • A GUID is unique, not secret. Do not use one as a password or an access token.
  • Values in the examples above are samples; your list will be different every time.

Frequently asked questions

Is a GUID the same as a UUID?
Yes. GUID is Microsoft's name for the 128-bit identifier that the rest of the world calls a UUID. The bytes and rules are the same; only the usual way of writing it differs, which is what the format options here cover.
Which format should I pick?
Use "B" with braces for .reg files, COM class IDs and Visual Studio project files. Use "D" for most databases and JSON. Use "N" when a system rejects hyphens, and "X" when you want to paste a constant straight into C or C# code.
Can two generated GUIDs ever be the same?
In theory yes, in practice no. A version 4 GUID has 122 random bits. You would need to make roughly 2.7 × 10^18 of them before the chance of any repeat reached one half.
Why are they uppercase by default?
Windows tools such as regedit and Visual Studio show GUIDs in capitals, so the default matches what you will see next to them. Untick Uppercase for lowercase, which is the usual style on Linux and in web APIs. Both are equally valid.
Does a GUID reveal my computer or the time?
Not these. Old version 1 GUIDs held a timestamp and the network card address. These are version 4, made only from random bytes on your device.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close