Skip to content
Knot’s Tools knottx.dev

Generate a UUID

Random, time-ordered or name-based. Free and private, made on your device.

Your UUID

Version. How it’s made.

Compare versions

RFC 9562

Versions, explained.

A UUID is a 128-bit identifier, written as 32 hexadecimal digits in groups of 8-4-4-4-12. RFC 9562 defines eight versions and two special values. They all look alike, but each is built differently, and two digits tell you which kind you have.

Reading a UUID

Example

3f2a9c1e-7b4d-4e8a-9c61-0d5be2f47a13

Version: the 13th digit
How the UUID was made, from 1 to 8. This one is version 4.
Variant: the 17th digit
The layout family. Every standard UUID uses 8, 9, a, or b here (binary 10xx). This one has 9.

The other 122 bits depend on the version. They can be random, a timestamp, a hash of a name, or a mix. Hyphens are just formatting, and uppercase and lowercase mean the same value.

Which version? Start here.

You just need a unique ID

Version 4

Fully random and reveals nothing. The safe default.

It’s a database key

Version 7

Sorted by creation time, so indexes stay compact and inserts stay fast.

Same input, same ID

Version 5

Derives a stable UUID from a namespace and a name, such as a URL.

You already use v1

Version 6

Keeps the v1 fields but in an order that sorts by time.

Version 4 or 7? The two you’ll reach for.

v4 Random

  • 122 random bits, with no time or machine information inside.
  • Values land at random spots in an index, which can fragment large B-tree tables.
  • Best when an ID shouldn’t reveal when it was created.

v7 Unix time

  • A millisecond timestamp followed by 74 random bits.
  • New values sort after old ones, so inserts append to the end of an index.
  • Anyone holding the ID can read roughly when it was created.

At a glance.

How every version is built, whether it sorts by time, and what it’s good for.

UUID versions compared
Version Built from Sorts by time Reveals time Good for
v1Timestamp, clock sequence, nodeNoYesLegacy systems
v2v1 with a local user or group IDNoPartlyRarely used · not generated here
v3MD5 of namespace + nameNoNoOlder deterministic IDs
v4Random bitsNoNoGeneral-purpose IDs
v5SHA-1 of namespace + nameNoNoDeterministic IDs
v6v1 fields, reorderedYesYesMoving off v1
v7Unix ms timestamp + randomYesYesDatabase keys, events, logs
v8Your own layoutDependsDependsCustom formats · not generated here
NilAll zeros–No“No value” placeholder
MaxAll ones–NoUpper-bound sentinel

Every version, in detail.

Each bar shows how the 128 bits are laid out.

v1 Gregorian time and nodeTimestamp, clock sequence, node ID

Counts 100-nanosecond intervals since 15 October 1582, the start of the Gregorian calendar. It adds a 14-bit clock sequence and a 48-bit node ID. The node was originally the machine’s MAC address. This generator uses a random node with the multicast bit set instead, so nothing about your device is exposed.

The low bits of the timestamp come first, so v1 values don’t sort by time. For new systems, prefer v7.

  1. time_low
  2. time_mid
  3. ver
  4. time_high
  5. var
  6. clock_seq
  7. node
v2 DCE SecurityReserved, rarely used

A variation of v1 that replaces part of the timestamp with a local identifier, such as a POSIX user or group ID. It comes from the DCE 1.1 specification. RFC 9562 reserves the number but doesn’t define it further. Libraries rarely support it, so this tool doesn’t generate it.

v3 Name-based, MD5Same namespace and name, same UUID

Hashes a namespace UUID and a name with MD5, then keeps 122 bits of the result. The same inputs always give the same UUID, on any machine, so you can derive stable IDs from things like domain names or URLs without storing a mapping.

It works exactly like v5 but with an older hash. Use v3 only to match existing data.

  1. md5_high
  2. ver
  3. md5_mid
  4. var
  5. md5_low
v4 Random122 random bits

Everything except the version and variant comes from a cryptographically secure random number generator. Nothing is encoded inside, so a v4 UUID reveals nothing about when or where it was made.

Collisions aren’t a practical concern. You would need about 2.7 × 1018 UUIDs for even a 50% chance of a single duplicate.

  1. random_a
  2. ver
  3. random_b
  4. var
  5. random_c
v5 Name-based, SHA-1Same namespace and name, same UUID

Hashes a namespace UUID and a name, encoded as UTF-8, with SHA-1. Standard namespaces exist for DNS names, URLs, ISO OIDs and X.500 names. Any UUID can also serve as your own namespace.

The output is predictable by design. Anyone who knows the namespace and name can compute the same UUID, so never use v5 to hide or protect a value.

  1. sha1_high
  2. ver
  3. sha1_mid
  4. var
  5. sha1_low
v6 Reordered Gregorian timeSortable v1

Holds the same timestamp, clock sequence and node as v1, but stores the timestamp most significant first. As a result, v6 values sort by creation time as plain text or bytes.

It exists mainly to help systems already built on v1. Without that history, v7 is simpler.

  1. time_high
  2. time_mid
  3. ver
  4. time_low
  5. var
  6. clock_seq
  7. node
v7 Unix time and randomRecommended for time-ordered IDs

Starts with a 48-bit Unix timestamp in milliseconds, then 74 random bits. New values sort after old ones, which keeps database indexes compact and makes IDs roughly sortable by creation time.

When several UUIDs are created in the same millisecond, this generator uses the 12 bits after the version as a counter so they still come out in order.

  1. unix_ts_ms
  2. ver
  3. rand_a
  4. var
  5. rand_b
v8 CustomYour own layout

Only the version and variant bits are fixed. The remaining 122 bits are yours to define, for example to embed a shard number or use a different hash. Other systems won’t know how to read your layout, so it’s for experiments and closed systems. This tool doesn’t generate it.

  1. custom_a
  2. ver
  3. custom_b
  4. var
  5. custom_c
Nil Nil and MaxSpecial values

Two fixed values that aren’t really versions. Use them as markers, never as real identifiers.

Nil: no UUID
00000000-0000-0000-0000-000000000000
Max: upper bound
ffffffff-ffff-ffff-ffff-ffffffffffff

Questions? Answers.

Is a UUID the same as a GUID?

Yes. GUID (globally unique identifier) is Microsoft’s name for the same 128-bit format. A UUID from this generator works anywhere a GUID is expected. Some Windows tools show GUIDs in uppercase or wrapped in braces, which is only formatting.

Can two UUIDs ever be the same?

In theory, yes. In practice, no. A version 4 UUID has 122 random bits, so you would need about 2.7 × 1018 of them for even a 50% chance of a single duplicate. Name-based versions (v3 and v5) are the exception: the same namespace and name always give the same UUID, on purpose.

Which UUID version should I use?

Use version 4 when you just need a unique ID. Use version 7 for database primary keys, because it sorts by creation time and keeps indexes compact. Use version 5 when the same input must always produce the same ID.

Are the UUIDs generated here private?

Yes. Every UUID is created locally in your browser, with randomness from the Web Crypto API. Nothing is uploaded, logged, or stored, and once the page has loaded it keeps working without a connection.

Can I use a UUID as a password or secret token?

Avoid it. UUIDs are identifiers, not secrets. Time-based and name-based versions are partly predictable, and even a random v4 UUID is not designed as a credential. Use a dedicated secret generator for passwords, API keys, and session tokens.