UUID v5 is a name-based UUID. Instead of random bits, it hashes a namespace UUID together with a name using SHA-1, so the same namespace and name always produce the same identifier. That makes it ideal when you need a stable, reproducible ID derived from existing data.
Key takeaways
- Deterministic: identical namespace + name always yields the same UUID.
- Uses SHA-1 hashing and is preferred over the older MD5-based UUID v3.
- Great for stable IDs from URLs, file paths, emails or external keys.
What makes UUID v5 different
Most UUIDs you generate are random (v4) or time-based (v7). UUID v5 is neither. It is derived by hashing a fixed namespace UUID and a name string with SHA-1, then writing the version and variant bits into the result. Because hashing is deterministic, the same inputs always produce the same UUID on any machine, in any language.
That property is the whole point. If two systems agree on the namespace and the name, they will independently compute the exact same identifier without ever talking to each other.
Choosing a namespace
A namespace is itself a UUID that scopes your names. RFC 9562 defines four well-known namespaces: DNS, URL, OID and X.500. Use the DNS namespace for hostnames, the URL namespace for URLs, or supply your own custom namespace UUID to keep your identifiers isolated from everyone else who hashes the same names.
Generating your own namespace once (a random v4 UUID) and reusing it across your application is a common and recommended pattern.
Namespace (URL) : 6ba7b811-9dad-11d1-80b4-00c04fd430c8
Name : https://example.com/thing
UUID v5 : deterministic SHA-1 hash of (namespace + name)Good UUID v5 use cases
Use UUID v5 when you want a UUID that maps one-to-one to something that already has a natural key: a URL, a file path, an email address, an external system ID or a tenant slug. Deduplication, idempotent imports and content-addressable references all benefit from stable IDs.
Avoid UUID v5 for values that must be unpredictable or secret. Because the output is a pure function of the inputs, anyone who knows the namespace and name can recompute the UUID.
UUID v5 vs UUID v3
UUID v3 works the same way but hashes with MD5 instead of SHA-1. For new systems, prefer UUID v5. SHA-1 is a stronger hash, and v5 is the version most current libraries and standards recommend when you need name-based UUIDs.