FreeAI.DevTools

Nil UUID Generator

What a Nil UUID is, when to use it, and a generator scoped to this version. Runs in your browser.

What is the nil UUID?

The nil UUID is 00000000-0000-0000-0000-000000000000, a special form defined in RFC 4122 and carried forward in RFC 9562 with all 128 bits set to zero. It parses as a valid UUID but belongs to no version, and it conventionally acts as a sentinel meaning empty, unknown, or not yet assigned.

The nil UUID
00000000-0000-0000-0000-000000000000

There is exactly one nil UUID, so there is nothing to generate. Copy it above.

Legitimate uses for an all-zeros identifier

The nil UUID earns its keep wherever a UUID-typed field needs an explicit "nothing here" value. Tree structures use it as the parent ID of root nodes when the schema forbids NULL foreign keys. Typed languages use it as the zero value: Go's uuid.Nil and C#'s Guid.Empty are both the nil UUID, so an unset struct field is detectable with a single comparison. Test fixtures use it as a stable, obviously-fake placeholder that no generator will ever collide with. RFC 9562 also added its mirror image, the max UUID ffffffff-ffff-ffff-ffff-ffffffffffff, with all 128 bits set to one, useful as the upper bound when range-scanning a UUID-keyed index just as nil serves as the lower bound.

The anti-pattern: storing nil instead of NULL

Trouble starts when nil UUIDs leak into database columns as a lazy stand-in for SQL NULL. A nullable column with NULL says "no value" in a way the database understands: NULL is excluded from equality joins, skipped by most index scans, and handled correctly by IS NULL predicates. A stored nil UUID is the opposite: it is a real value that joins happily against any other accidental nil, so one unset field on each side of a join can fabricate row matches out of nothing.

The rule we follow: if the column can be absent, make it nullable and store NULL. Reserve the nil UUID for in-memory sentinels, wire formats that cannot express null, and schemas where a non-null placeholder is a deliberate, documented choice.

Frequently asked

Is the nil UUID a valid UUID?
Yes. RFC 4122 defined the nil UUID as a special form with all 128 bits set to zero, and RFC 9562 retains it. It passes format validation and parses in every standard library, but its version and variant fields are zero, so it does not belong to any generation algorithm.
Should I store the nil UUID instead of NULL in my database?
Usually not. SQL NULL is excluded from equality joins and supports IS NULL semantics, while a stored nil UUID is a real value that will happily join against every other nil in the database, silently matching unrelated rows. Prefer a nullable column with NULL, and keep nil as an in-memory or wire-format sentinel.
What is the max UUID?
The max UUID is ffffffff-ffff-ffff-ffff-ffffffffffff, with all 128 bits set to one. RFC 9562 introduced it in May 2024 as the counterpart to the nil UUID. It is useful as the upper bound in range queries over UUID-keyed data, with nil serving as the corresponding lower bound.

More in this series

// The subscription desk

The Inference Report

The weekly briefing for AI engineers: model releases, pricing moves, benchmarks, and the news that changes what you should build with and what it costs. Every Tuesday, 5-minute read. No fluff.

Join AI engineers who stopped overpaying for tokens. Unsubscribe anytime.