UUID v5 Generator
Generate deterministic UUIDs by SHA-1 hashing a namespace UUID with a name. Same input always produces the same UUID — useful for stable, reproducible identifier derivation.
Your V5 UUID
V5UUIDs from the same namespace + name are deterministic and identical every time.
What is UUID v5?
UUID v5 is the "name-based, SHA-1" variant defined by RFC 4122 and carried forward unchanged by RFC 9562. It produces a deterministic, repeatable UUID from two inputs:
- Namespace — a UUID that scopes the name. RFC 4122 defines DNS, URL, OID, and X.500 namespaces; you can also invent your own.
- Name — any string. Typically the natural identifier of the entity (email address, URL, file path).
The algorithm: SHA-1(namespace_bytes || name_bytes) truncated to 128 bits, with 6 bits overwritten to encode the version (5) and variant (2). Because SHA-1 is deterministic, the result is always the same for the same inputs.
When should I use UUID v5?
- Migration. Map legacy string keys (emails, slugs, URLs) to stable UUIDs without a lookup table.
- Content-addressable IDs. Derive an identifier from normalized content so the same content is recognized across services.
- Idempotent imports. Re-running an import job produces the same UUIDs, so it can be deduplicated by primary key.
How to generate UUID v5 in your code
JavaScript / TypeScript
import { v5 as uuidv5 } from 'uuid';
const id = uuidv5('example.com', uuidv5.DNS);
// Always: 'cfbff0d1-9375-5685-968a-48ce8b50e3d2'Python
import uuid
id = uuid.uuid5(uuid.NAMESPACE_DNS, 'example.com')
print(str(id))
# → 'cfbff0d1-9375-5685-968a-48ce8b50e3d2'Go
import "github.com/google/uuid"
ns := uuid.NameSpaceDNS
id := uuid.NewSHA1(ns, []byte("example.com"))Frequently asked questions
UUID v5 is a deterministic UUID derived by SHA-1 hashing a 16-byte namespace UUID concatenated with a name. The same namespace + name always produces the same UUID. RFC 9562 recommends v5 over v3 for new applications because SHA-1 is cryptographically stronger than MD5.