What is a UUIDv5?
UUIDv5 generates a deterministic UUID by computing a SHA-1 hash of a namespace UUID and a name string. Given the same namespace and name, UUIDv5 will always return the same UUID. This makes it ideal for generating consistent identifiers from known inputs.
The format is
xxxxxxxx-xxxx-5xxx-yxxx-xxxxxxxxxxxx,
where 5
indicates the version and
y
is the variant (8/9/a/b). The remaining bits come from the SHA-1 hash output.
Standard Namespaces
| Namespace | UUID | Use Case |
|---|---|---|
| DNS | 6ba7b810-9dad-11d1-80b4-00c04fd430c8 | Domain names (e.g., "example.com") |
| URL | 6ba7b811-9dad-11d1-80b4-00c04fd430c8 | Full URLs |
| OID | 6ba7b812-9dad-11d1-80b4-00c04fd430c8 | ISO Object Identifiers |
| X.500 | 6ba7b814-9dad-11d1-80b4-00c04fd430c8 | X.500 Distinguished Names |
When to Use UUIDv5
- Stable IDs from names: Generate the same UUID for "example.com" every time, across any system.
- Content addressing: Map resources (URLs, files, records) to deterministic identifiers.
- Deduplication: If two systems independently generate a v5 UUID from the same namespace + name, the result is identical.
If you need random IDs instead, use UUIDv4. UUIDv5 is preferred over UUIDv3 (which uses MD5 instead of SHA-1).
Frequently Asked Questions
- What is the difference between UUIDv3 and UUIDv5?
- Both are deterministic (namespace + name), but v3 uses MD5 and v5 uses SHA-1. SHA-1 is considered more robust, so v5 is generally preferred for new applications.
- Can I reverse a UUIDv5 to find the original name?
- No. SHA-1 is a one-way hash function. You cannot recover the input name from the resulting UUID.
- Is my data sent to a server?
- No. UUIDs are generated and validated entirely in your browser. Nothing is sent to any server.