Home/Empty GUID & Nil UUID
Reference · RFC 9562 · Copy & check

Empty GUID & Nil UUID

Copy the all-zero GUID in any format, see how to create and check it in C#, SQL, Python, Java and JavaScript, and fix the most common “empty GUID” errors.

Quick answer: the empty GUID (also called the Nil UUID) is 00000000-0000-0000-0000-000000000000 — all 128 bits set to zero. In C# it is Guid.Empty. It is a valid UUID format, but it should only be used as a placeholder, never as a real ID.

Copy the empty GUID

Standard00000000-0000-0000-0000-000000000000
C# / .NETGuid.Empty
No hyphens00000000000000000000000000000000
With braces{00000000-0000-0000-0000-000000000000}
URNurn:uuid:00000000-0000-0000-0000-000000000000
Max UUIDffffffff-ffff-ffff-ffff-ffffffffffff

Is this GUID empty?

What is an empty GUID?

An empty GUID is a GUID or UUID where every one of its 128 bits is zero: 00000000-0000-0000-0000-000000000000. The UUID standard, RFC 9562, calls it the Nil UUID. Microsoft’s .NET calls it Guid.Empty. They are the same value.

It is 36 characters long like any other UUID: 32 zeros plus 4 hyphens. See the UUID length guide for every format.

Empty GUID vs null

An empty GUID and null are not the same thing. Null means “no value at all”. An empty GUID is a real value that happens to be all zeros.

  • In C#, Guid is a value type, so it can never be null. Its default value is Guid.Empty, which means default(Guid) and new Guid() both equal Guid.Empty.
  • If you need “no value”, use a nullable Guid?. Then you may need to check for both null and empty.
  • In a database, a NULL column and a column holding 00000000-0000-0000-0000-000000000000 are different. Queries that look for one will not find the other.

How to create an empty GUID in code

C#
Guid empty = Guid.Empty; // 00000000-0000-0000-0000-000000000000 Guid alsoEmpty = default(Guid); // same value
SQL Server
SELECT CAST(‘00000000-0000-0000-0000-000000000000’ AS uniqueidentifier);
PostgreSQL
SELECT ‘00000000-0000-0000-0000-000000000000’::uuid; — or, with the uuid-ossp extension: SELECT uuid_nil();
Python
import uuid empty = uuid.UUID(int=0) # works in every Python 3 version # Python 3.14+ also has: uuid.NIL and uuid.MAX
Java
UUID empty = new UUID(0L, 0L);
JavaScript / TypeScript
// Plain constant const EMPTY_GUID = ‘00000000-0000-0000-0000-000000000000’; // Or from the uuid npm package import { NIL as NIL_UUID } from ‘uuid’;
Go
import “github.com/google/uuid” empty := uuid.Nil

More examples are in the PostgreSQL, Python, Java, JavaScript and Go guides.

How to check if a GUID is empty

C#

C#
if (id == Guid.Empty) { /* not set */ } // Nullable GUID: check for null and empty if (id is null || id == Guid.Empty) { /* not set */ }

SQL Server: null or empty

SQL Server
SELECT * FROM Orders WHERE CustomerId IS NULL OR CustomerId = ‘00000000-0000-0000-0000-000000000000’;

JavaScript / TypeScript

JavaScript
const isEmpty = (id) => !id || id.toLowerCase() === ‘00000000-0000-0000-0000-000000000000’;

Compare GUIDs case-insensitively, because 0 has no case but other UUIDs you compare against might be uppercase. You can also paste any value into the checker at the top of this page.

Common empty GUID errors and how to fix them

“Expected non-empty Guid”

You may see this in Microsoft Dynamics 365 or Dataverse when code sends Guid.Empty where a real record ID is required, for example in an update or a lookup. The fix is to make sure the ID was actually set, such as by reading it from the created record, before you send the request.

FluentValidation: GUID must not be empty

For a Guid property, RuleFor(x => x.Id).NotEmpty() fails when the value is Guid.Empty, because that is the type’s default value. This is usually what you want: it catches IDs that were never assigned.

New records saved with an all-zero ID

If rows in your database have the ID 00000000-0000-0000-0000-000000000000, the code most likely never generated a GUID and saved the default value. Generate a real one with Guid.NewGuid(), a database default such as NEWID(), or the GUID generator.

When to use the Nil UUID, and when not to

  • Good uses: a placeholder or default before a real ID is assigned, a “not set” marker in APIs, and a fixed value in tests.
  • Avoid: using it as a real primary key or record ID. Every system that does this gets the same “ID”, which defeats the point of a unique identifier.
If you must tell “missing” apart from “empty”, use null (or a nullable type) for missing and reserve the Nil UUID for an explicit “none” value. Mixing the two is a common source of bugs.

Is an empty GUID a valid UUID?

Its format is valid: 32 hex digits in the 8-4-4-4-12 pattern. But it has no version (the version digit is 0), so strict validators that only accept versions 1 to 8 may reject it. You can inspect any UUID, including the Nil UUID, with the UUID decoder.

A normal generator will never return it. A random UUID v4 always has 4 as the first digit of its third group, so it cannot be all zeros.

What is the Max UUID?

The Max UUID is the opposite of the Nil UUID: all 128 bits set to one, written ffffffff-ffff-ffff-ffff-ffffffffffff. It was added in RFC 9562 (2024). It is useful as an upper bound, for example when scanning a range of sorted UUIDs. The uuid npm package exports it as MAX (version 10+).

Frequently asked questions

No. Guid.Empty is a real value made of all zeros. A plain Guid in C# can never be null; only a nullable Guid? can.

32 zeros, split into groups of 8-4-4-4-12 by four hyphens, for a total of 36 characters.

Compare it with Guid.Empty: if (id == Guid.Empty). For a nullable Guid?, check both: if (id is null || id == Guid.Empty).

No. They create random version 4 GUIDs, which always have 4 as the first digit of the third group, so the result can never be all zeros.

The Nil UUID has all 128 bits set to zero (00000000-0000-0000-0000-000000000000). The Max UUID has all bits set to one (ffffffff-ffff-ffff-ffff-ffffffffffff).