Nil UUID — What Is It and When to Use It?
The nil UUID is the UUID that is all zeros: 00000000-0000-0000-0000-000000000000. RFC 4122 defines it as a special value meaning “no UUID” or “unknown UUID.”
What It Is
It has the same 8-4-4-4-12 structure as any UUID, but every nibble is 0. It is valid and has a defined variant and version (nil). Our validator and validation API recognize it and report type: "nil". You can generate it from our generator (version “Nil”) or API (/api/version-nil).
When to Use It
- Placeholder: Represent “no ID yet” or “unset” in a field that must be a UUID (e.g. optional foreign key).
- Defaults: Initialize variables or structs to a known “empty” UUID before assigning a real one.
- Tests: Use as a sentinel or default value in fixtures and mocks.
When Not to Use It
Don’t use the nil UUID as a normal entity ID. It’s a single global value—every “nil” is the same. For real uniqueness, use v4 or v7. Don’t use it where “missing” should be represented by null or an optional field; use nil UUID only when the type system or schema requires a UUID and you need a single canonical “none” value.