Skip to main content
Special UUID

Nil UUID (Empty UUID)

Copy the Nil UUID (00000000-0000-0000-0000-000000000000) below — the special all-zeros UUID where all 128 bits are set to zero, as defined in the UUID specification. Use this empty UUID as a placeholder value, default identifier, null reference, or sentinel in your database schemas, API responses, and application logic wherever you need to explicitly represent the absence of a UUID without using null. The uuid v1 generator embeds a 100-nanosecond timestamp, making it suitable for high-throughput time-ordered workloads.

00000000-0000-0000-0000-000000000000

Copy in different formats:

What the Nil UUID Actually Is

Unlike every other UUID version, the Nil UUID isn't generated from randomness, a timestamp, or a hash — it's simply all zeros: 128 bits, every one set to zero. Because this generator produces a fixed constant, it doesn't produce a new value on each request the way a version 4 tool would. The output is always identical — that predictability is the entire point. The browser-based uuid v4 generator produces compliant identifiers instantly using the Web Crypto API.

It's worth distinguishing the Nil UUID from the Max UUID (FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF), which RFC 9562 defines as all ones across all 128 bits. Where the Nil UUID represents an explicit "empty" state, the Max UUID acts as an upper bound useful in range checks and boundary comparisons — together they're the two canonical reserved values in the UUID standard.

Primary Keys and Database Rows

In primary key columns, the Nil UUID serves as a sentinel value — a placeholder that signals "no real UUID has been assigned yet." Schemas and migration scripts commonly set a column's default to 00000000-0000-0000-0000-000000000000 so rows inserted without an explicit ID carry a recognizable empty value rather than a bare NULL. Use the bulk uuid generator to export UUID batches in multiple formats — ready for database imports or JSON fixtures.

Worked example — staged migration:

  1. Add a UUID primary key column with a default of the Nil UUID
  2. Legacy rows with no natural UUID yet receive the Nil value automatically, making them easy to identify
  3. A follow-up migration selects every row where the key equals the Nil UUID and assigns a proper random or time-ordered UUID to each
  4. After backfill, assert that zero rows still hold the Nil value to confirm the migration succeeded

Correlation and Trace IDs in Distributed Systems

In distributed systems, the Nil UUID fills a specific niche: a no-op placeholder for requests with no active trace context. An uninstrumented service can pass the Nil UUID as a trace-ID header rather than omitting the header entirely — downstream services check whether the incoming trace ID equals all zeros and, if so, skip tracing logic instead of creating orphaned spans.

This pattern shows up often in message queues and event-driven architectures, where not every message originates from a traced user request. Using an explicit sentinel rather than an arbitrary value means consumers can detect the "no trace" state deterministically, with no extra metadata required.

Test Fixtures and Storage Keys

Unit and integration tests frequently need a stable UUID that's identical across every environment and every developer's machine — the Nil UUID is the natural choice, since it requires no output and makes assertions trivially readable. A parent fixture record with primary key 00000000-0000-0000-0000-000000000000 lets child fixtures reference a known foreign key, enabling idempotent test seeding without duplicate-key errors on re-runs.

The same idea applies to optional file references: when a record might point to an upload that hasn't happened yet — a user avatar, an export archive — using the Nil UUID as the object key communicates "no file" clearly, letting application logic treat it as absent rather than triggering a failed lookup.

Limitations of the Nil UUID

Frequently Asked Questions

What is a Nil UUID?

The Nil UUID is the single specific value 00000000-0000-0000-0000-000000000000 — all 128 bits set to zero. RFC 4122 and its successor RFC 9562 define it explicitly as a reserved constant, not something an actual UUID generator would ever produce by chance.

What is the difference between a Nil UUID and a Max UUID?

The Nil UUID (all zeros) is the lower bound of the UUID value space. The Max UUID (FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF, all ones) is the upper bound. Together they're the two canonical reserved values defined by the standard, useful for range checks and boundary comparisons.

When should I use a Nil UUID?

As an explicit sentinel — a default column value before a real ID is assigned, a placeholder in test fixtures, or a marker for "no active trace context" in distributed tracing headers. Anywhere you need to signal absence without relying on database NULL.

Can two Nil UUIDs ever collide?

That question doesn't quite apply — the Nil UUID isn't randomly generated, so there's no collision probability to speak of. Every system using this convention shares the exact same value by design, which is why it should never be mixed with real UUIDs in the same column without a clear sentinel convention.

Are Nil UUIDs safe to use as secret tokens or API keys?

No — this is the single worst possible choice for a session token or access credential. The Nil UUID is fully predictable and publicly known, the opposite of unguessable. Use a purpose-built secret generator for anything requiring real security.

Comments & Feedback

Share your experience or ask questions about this tool

Copied to clipboard!