Your NIL UUID — Click to copy
UUID Anatomy
What is NIL?
Nil UUID Reference — Complete Guide
The Nil UUID is a special-purpose UUID defined in RFC 9562 where all 128 bits are set to zero, resulting in the identifier 00000000-0000-0000-0000-000000000000. It is not randomly generated — it is always exactly the same value. The Nil UUID is conceptually similar to null or None in programming languages: it represents the absence of a meaningful UUID. Unlike other UUID versions, the Nil UUID has no version digit and no variant bits set according to the normal RFC pattern.
RFC 9562 Definition: The Nil UUID is 00000000-0000-0000-0000-000000000000 — all 128 bits are zero. It does not follow the version/variant bit pattern of other UUIDs (the version field is 0 and the variant bits are 00). RFC 9562 defines it explicitly as a special case and notes that it should not be confused with a randomly generated UUID.
When to Use NIL
Use the Nil UUID as a default or initial value before a real UUID is assigned, as a sentinel value in APIs to indicate "no ID" or "not set", as a placeholder in data structures that require a UUID field but may not have a valid value yet, for testing and mocking where a predictable UUID value is needed, and in protocol designs where a zero UUID carries special meaning. The Nil UUID should never be used as a real entity identifier — it is always a placeholder.
Advantages
- ✅ Defined by RFC 9562
- ✅ Consistent — always the same value
- ✅ Native support in most languages (Guid.Empty, uuid.UUID(int=0))
- ✅ Useful as null/default placeholder
Considerations
- ⚠️ Must never be used as a real entity identifier
- ⚠️ May cause confusion if misused as a regular UUID
- ⚠️ Not a randomly generated UUID
UUID Structure
| Field | Bits | Description |
|---|---|---|
| All fields | 128 bits | All set to binary 0 — displayed as hex 0s |
| Version | 4 bits | All zero — not a normal UUID version |
| Variant | 2 bits | All zero — not RFC 9562 variant |
| Value | Fixed | 00000000-0000-0000-0000-000000000000 |
Code Examples
Any Language
// The Nil UUID is always the same value const nilUUID = '00000000-0000-0000-0000-000000000000'; # Python import uuid nil = uuid.UUID(int=0) print(nil) # 00000000-0000-0000-0000-000000000000 // Java UUID nil = new UUID(0L, 0L); // C# Guid nil = Guid.Empty;
SQL
-- PostgreSQL SELECT '00000000-0000-0000-0000-000000000000'::uuid; -- SQL Server SELECT CAST('00000000-0000-0000-0000-000000000000' AS UNIQUEIDENTIFIER); -- Or use the empty GUID constant SELECT '00000000-0000-0000-0000-000000000000';
Frequently Asked Questions
What is the Nil UUID used for? ▾
The Nil UUID is used as a placeholder or null value in systems that require a UUID field but may not have a meaningful value. Common uses include default values in database columns before a real ID is assigned, API responses indicating "no associated entity", and sentinel values in data structures.
Is the Nil UUID the same as UUID version 0? ▾
No. The Nil UUID is a special case defined in RFC 9562 — it is not "version 0". The version field in a Nil UUID is all zeros, which does not correspond to any regular UUID version. It exists outside the normal UUID version numbering scheme.
How do I check if a UUID is Nil? ▾
Compare the UUID string to the constant "00000000-0000-0000-0000-000000000000" (case-insensitive), or in typed languages: Python — uuid == uuid.UUID(int=0), Java — uuid.equals(new UUID(0L, 0L)), C# — guid == Guid.Empty.
Can I store the Nil UUID in a database UUID column? ▾
Yes. All database UUID/UNIQUEIDENTIFIER column types accept the Nil UUID as a valid value. It is treated like any other UUID for storage purposes — it is only the application layer that gives it special meaning.
Related Tools