UUID generator · formatNil UUID — the zero identifier
The nil UUID has all 128 bits set to zero. It is not random but known in advance: it serves as an explicit “no identifier” where an empty value is not allowed. It has neither version nor variant. Its counterpart, the max UUID, has every bit set.
zero where the version goes: no version, not “version 0”
0
zero where the variant goes too
000000000000
neither time nor randomness
When to use it
A default in a column that does not allow NULL.
A “not assigned yet” marker in protocols and files where the field is mandatory.
Not a real identifier: it is the same for everyone.
How it differs from its neighbours
Against NULL: nil is a value and NULL is its absence; nil passes format checks and takes part in unique indexes, so a unique column cannot hold it twice. Against the max UUID: both are placeholders from RFC 9562; max has every bit set and is used as the upper bound of a range. Generating nil in bulk is pointless — it never changes.
To state “no identifier” explicitly where a field must be filled: a NOT NULL column, a mandatory protocol field, a default in a structure. Nil is a known constant of all zeros, so absence is recognised at once. In .NET it is Guid.Empty, in Java new UUID(0, 0), and in RFC 9562 the Nil UUID.
If the column allows NULL, NULL is usually better: it honestly means absence and stays out of unique indexes. Nil is a real value: two rows holding it cannot coexist in a unique column, and a foreign key will demand a row with that ID. Nil is chosen when NULL is unavailable — in a format, a protocol or a language without null references.
Nil's counterpart from RFC 9562: all 128 bits set, ffffffff-ffff-ffff-ffff-ffffffffffff. It serves as the upper bound of a range or as an “any value” marker — for example, in queries like “all identifiers up to the maximum”. Like nil, it has neither version nor variant: it is a placeholder, not an identifier.
A format check, yes: 32 hexadecimal digits in their places. A strict version check, no: the version position holds zero while 1–8 are allowed, so some validators handle nil separately. The Check field on the generator page calls it the zero identifier rather than a non-standard version, so a placeholder is not mistaken for an error.
As a string with a type cast: '00000000-0000-0000-0000-000000000000'::uuid. It can serve as a column default or be compared against in queries. PostgreSQL has no dedicated nil function. In application code a constant is handier — Guid.Empty in C#, uuid.UUID(int=0) in Python — than typing thirty-two zeros by hand each time.
No. Versions 4 and 7 have some bits fixed: 4 or 7 in the version position and 8, 9, a or b in the variant position. An all-zero value is impossible for them in principle, not merely unlikely. That is why nil unambiguously means a placeholder and cannot be confused with a real identifier.
This site uses cookies and Yandex Metrica to understand how it’s used. Metrica loads only after you consent.Metrica and cookies — only after “Accept”.Consent to data processing · Learn more