Go REST

UUID generator (v1, v4, v7) and inspector

Generate UUIDs in your browser. Pick a version, set a count, copy the output. Below the generator there's an inspector that reads back a UUID's version, variant, and embedded timestamp.

Output

Inspect a UUID

What is a UUID?

A UUID (Universally Unique Identifier, also called GUID on Microsoft platforms) is a 128-bit number written as 32 hexadecimal digits in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. UUIDs are designed to be generated independently by any system without coordination, while staying unique with overwhelmingly high probability.

The current standard is RFC 9562 (May 2024), which superseded RFC 4122. It defines eight versions; v4 and v7 are the ones you'll see in modern code, v1 is legacy, and the NIL UUID is the all-zeros sentinel.

When to use this tool

  • Generating a primary key for a new row.Most modern databases happily store UUIDs as 16-byte columns and let you generate them client-side, removing a round-trip to fetch an auto-increment ID.
  • Building an idempotency key.Add a X-Idempotency-Key: <uuid> header to a POST so retries don't double-create.
  • Filling in a test fixture or a config value.When you need a stable random ID for a seeded record or feature flag, v4 is the easy choice.
  • Reading back a UUID to debug it.The inspector tells you whether you're holding a v1, v4, or v7 - and for v1/v7, what time it was minted.

How UUIDs work under the hood

A UUID is a 16-byte value with two reserved nibbles: the version (high nibble of byte 6) names the algorithm that produced the UUID, and the variant (high bits of byte 8) names the layout convention. Everything else is algorithm-dependent.

  • v1 - 60-bit timestamp (100-nanosecond ticks since 1582-10-15 UTC) plus a 14-bit clock sequence and a 48-bit node ID. Classic implementations used the host MAC address as the node, which leaks hardware identity; modern code uses a random multicast node, which the inspector confirms.
  • v4 - 122 bits of randomness with version and variant bits fixed. No structure, no order. The simplest UUID to generate and the default for most uses.
  • v7 - 48-bit millisecond timestamp followed by 74 bits of randomness. Time-sortable: v7 UUIDs created near each other in time sort lexicographically near each other, which dramatically improves B-tree index locality compared to v4.
  • NIL - 00000000-0000-0000-0000-000000000000. A defined placeholder meaning "no UUID".

Worked examples

  • f47ac10b-58cc-4372-a567-0e02b2c3d479is a v4 UUID. The 4 at position 13 is the version nibble; the a at position 17 has the high bit set, marking RFC 9562 variant.
  • 018d4d34-b7e0-7c50-9b27-3fd9e7a3d2e1is a v7 UUID. The first 12 hex digits (018d4d34b7e0) are a millisecond timestamp; the 7 at position 13 names v7.
  • c232ab00-9414-11ec-b3c8-9e6bdeced846is a v1 UUID. The 1 at position 13 names v1; the inspector decodes the embedded timestamp.
  • NIL(00000000-...) is a v0/NIL marker. Some libraries use it as "unknown user" or "system actor".

Common pitfalls

  • v4 as a primary key.v4 is random, which scatters writes across the B-tree and tanks insert performance on large tables. If you need UUIDs as primary keys, use v7.
  • Treating UUIDs as secrets.A v4 UUID is unguessable enough to be a session token, but a v1 or v7 UUID isn't - the timestamp prefix narrows the search space dramatically. Use real random tokens for security.
  • Comparing as strings vs bytes.UUIDs sort differently as 36-char strings (lexicographic) vs as 16-byte binary (numeric). Stay consistent across your stack.
  • MAC leak in classic v1.Old libraries embed the real MAC into v1 UUIDs. If you see a v1 UUID with the multicast bit (the lowest bit of the first node byte) clear, it likely encodes a hardware MAC.
  • Storing as VARCHAR(36).Costs 36 bytes per row and forces string comparison. Use the native UUID type (uuid in Postgres, BINARY(16) in MySQL) for half the storage and faster compares.

FAQ

Which UUID version should I use?

For new code, prefer v7. It is random enough for security and time-sorted, which improves database index locality. v4 is the right default if you want pure randomness with no embedded data.

Are UUIDs really unique?

In practical terms, yes. A v4 UUID has 122 bits of randomness; generating a billion per second for a century gives you roughly a 50% chance of one collision.

What's the difference between UUID v4 and v7?

v4 is purely random. v7 prefixes a 48-bit timestamp, so v7 UUIDs created near each other in time sort near each other - useful as a database primary key.

Does v1 leak my MAC address?

Classic v1 includes the host MAC address. This implementation generates a random multicast node ID instead, so no real hardware identifier leaks. Modern systems usually do the same.

Why is the NIL UUID useful?

NIL (all zeros) is a defined sentinel meaning "no UUID". Useful as a placeholder where the API requires a UUID column but no value applies.