GUID Generator with C# Snippets

Generate 1 to 100 GUIDs in any of .NET's five ToString format specifiers (D/N/B/P/X), with live C# and SQL Server snippets built from the current selection, and a one-click Guid.Empty sentinel example.

By Pankaj Kumar · DevToolsHub · Last updated Aug 2026

What this tool does

Generate 1 to 100 GUIDs in any of .NET's five string format specifiers, with ready-to-paste C# and SQL Server snippets that update as you change the format, case, or count. GUID values are generated entirely in your browser using the Web Crypto API's crypto.randomUUID() — the same client-side approach as our UUID Generator, and identical output to Guid.NewGuid() in .NET.

How this differs from our UUID Generator

The UUID Generator is the general-purpose tool — plain values, one format, for anyone who just needs a unique ID. This page is the .NET-flavored sibling: five Guid.ToString() format specifiers labeled by their actual C# format string, a case toggle, a one-click Guid.Empty sentinel, and live C#/SQL Server snippets built from whatever you just generated — for when you specifically need to see how a value looks as a C# literal or a uniqueidentifier, not just the raw value.

Format specifier reference

SpecifierNameExample
"D"Hyphenated (default)35918bc9-196d-40ea-9fd5-a10e22088814
"N"No hyphens35918bc9196d40ea9fd5a10e22088814
"B"Braces{35918bc9-196d-40ea-9fd5-a10e22088814}
"P"Parentheses(35918bc9-196d-40ea-9fd5-a10e22088814)
"X"Hex array{0x35918bc9,0x196d,0x40ea,{0x9f,0xd5,0xa1,0x0e,0x22,0x08,0x88,0x14}}

Call guid.ToString("N") (or any of the other four letters) in C# to get these directly — this tool exists so you can see the actual shape of each before you commit to one in code.

GUID vs UUID in .NET

They're the same specification (RFC 4122 / RFC 9562) under two names — GUID is Microsoft's term, UUID is everyone else's. System.Guid in .NET is a UUID. Guid.NewGuid() produces a version 4 (random) UUID, which is exactly what this page's generator and our UUID Generator both produce client-side via crypto.randomUUID().

Guid.Empty as a sentinel

Guid.Empty (00000000-0000-0000-0000-000000000000) is commonly used as a sentinel meaning "not yet assigned" or "no value" in code paths where Guid? (nullable) would add friction — e.g. a default parameter value, or an entity's foreign key before it's linked to a real record. Comparing against it (id == Guid.Empty) is a common validation check before treating an ID as real. Click Use Guid.Empty instead above to see it rendered in every format.

How to use this tool

  1. Set the count (1–100), pick a format specifier, and toggle case.
  2. Click Generate (or Ctrl+Enter).
  3. Copy individual values, or copy the C# or SQL Server snippet, which always reflects the first generated value and your current format/case selection.

Unlike a generic GUID generator .NET developers might reach for by accident, this one saves the extra step of "generate GUID for SQL Server" — the T-SQL snippet is generated for you automatically, no need to look it up separately once you've picked a value.

This tool is built with ASP.NET Core 8, Blazor Server, and the Web Crypto API (crypto.randomUUID) for generation, System.Guid format specifiers for display. It runs securely on Microsoft Azure.
Input Section
Output Section

Click Generate to create one or more GUIDs.