Nil UUID
The all-zero UUID. RFC-defined sentinel, not a generated value.
Show all 0
The literal value
00000000-0000-0000-0000-000000000000 What's special about it
The nil UUID is reserved by RFC 4122. No legitimate generator will ever produce it (the version and variant bits are required to be non-zero), which makes it a safe sentinel — you can be sure that a value of all zeros was deliberately set, not accidentally generated.
The max UUID (FF…FF)
RFC 9562 added a counterpart, the max UUID, all bits set:
ffffffff-ffff-ffff-ffff-ffffffffffff. It's useful as an
upper bound in range queries when you want "everything up to (but not
including) any real UUID."
Common pitfalls
- Some libraries treat nil as "null" in serialization. Check before storing it as a real value.
- Don't use nil as a default in a UNIQUE column — you'll get constraint violations.
- Don't compare against nil with string equality before normalizing case. Most libraries emit lowercase, but a hand-written constant might be uppercase.
- Some ORMs serialize nil as
NULLin JSON. If a downstream service expects the literal string, you'll see surprising failures only on the nil case.
Real-world use cases
The nil UUID shows up in a handful of legitimate places:
- Migration sentinels. When backfilling a new
uuidcolumn on an existing table, use nil as a temporary "not yet assigned" marker, then update in batches. - Test fixtures. A constant nil in unit tests makes assertions readable:
expect(user.id).toEqual(NIL_UUID)is clearer than a generated value. - Disabled / disconnected references. A foreign key field meaning "not associated with any parent" can use nil instead of
NULLif you need a non-nullable column. - RPC handshakes. Some protocols send nil during connection setup before a real session UUID is negotiated.
Generating nil in code
// JavaScript
import { NIL } from "uuid";
NIL; // "00000000-0000-0000-0000-000000000000"
// Python
import uuid
str(uuid.UUID(int=0))
// C#
Guid.Empty.ToString()
// Go
import "github.com/google/uuid"
uuid.Nil.String()
// PostgreSQL
SELECT '00000000-0000-0000-0000-000000000000'::uuid; RFC reference
RFC 4122 §4.1.7 reserves the nil UUID. RFC 9562 (2024) §5.9 reaffirms it and adds the max UUID (§5.10). Both are exempt from version and variant bit checks — a parser that strictly validates those bits should still accept nil and max as special cases.
FAQ
What is the nil UUID?
The nil UUID is the all-zero UUID: 00000000-0000-0000-0000-000000000000. RFC 4122 reserves it as a special value, distinct from any generated UUID.
What about the max UUID?
RFC 9562 (2024) also defines a max UUID: ffffffff-ffff-ffff-ffff-ffffffffffff, all bits set. Useful as an upper sentinel in range queries.
When would I actually use nil?
As a sentinel in databases that have a NOT NULL UUID column but need a 'no value' marker. As a placeholder during construction. As a comparison value in tests. Don't use it for real records — many libraries treat it specially.