๐Ÿ†” UUID v5 Generator (Namespace-based)

The same namespace and name combination always produces the same UUID (RFC 4122 UUID v5, SHA-1 based).

Enter a valid namespace UUID and name

Enter a namespace UUID and a name string to generate an RFC 4122 UUID v5. Unlike random UUID v4s, a UUID v5 is deterministic (SHA-1 hash-based) โ€” the same namespace and name combination always produces the same UUID.

How to use

  1. Select a namespace (the standard DNS, URL, OID, or X.500 namespace, or a custom UUID).
  2. Enter a name (any string).
  3. The generated UUID v5 is shown automatically.

How the calculation works

A version 5 UUID is a deterministic UUID derived from a namespace and a name: anyone computing it gets the same result. It is defined in RFC 4122, now RFC 9562. 1. Take the namespace UUID as 16 bytes and append the name as UTF-8 bytes. 2. Compute the SHA-1 hash of the whole (20 bytes) and keep the first 16 bytes. 3. Set the top 4 bits of byte 7 to the version number 5, and the top 2 bits of byte 9 to the variant 10. The namespace can be one of the predefined DNS, URL, OID or X.500 namespaces, or any UUID. The same name in different namespaces gives different UUIDs.

Worked example

Namespace: DNS (6ba7b810-9dad-11d1-80b4-00c04fd430c8) Name: python.org Result: 886313e1-3b8a-5372-9b90-0c9aee199e5d This matches the uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org') example in the Python documentation. The third group starting with "5" shows it is version 5.

Things to be aware of

  • Because the same input always gives the same UUID, it is handy for stable IDs derived from URLs or email addresses.
  • Anyone who knows the name can compute the UUID, so use random version 4 UUIDs for IDs that must not be guessable.
  • Version 3 works the same way with MD5. Version 5 is recommended for new use.

FAQ

What's the difference between UUID v4 and v5?

UUID v4 is fully random, generated from cryptographic randomness. UUID v5 is deterministic โ€” it's generated by SHA-1 hashing a "namespace UUID" and a "name" together, so the same input always produces the same result.

What are the standard namespace UUIDs?

RFC 4122 defines four standard namespace UUIDs: DNS, URL, OID, and X.500. For example, generating a UUID v5 from the DNS namespace and "python.org" always produces the same value (886313e1-3b8a-5372-9b90-0c9aee199e5d).

What's this useful for?

It's handy when you want a reproducible ID derived from a known string (like a URL or domain name), or when you need to deterministically assign unique IDs rather than generating random ones.