UUID generator · Guide
UUID Generator From String: Deterministic Identifiers
Producing the same UUID from the same string every time is exactly what UUID v5 is for. It turns any stable key — an email, a SKU, a file path — into a UUID that any system can recompute independently.
Use v5, not a hash you format yourself
v5 hashes a namespace UUID plus your string with SHA-1 and formats the result with correct version and variant bits:
import uuid
NS = uuid.UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8') # your own constant
uuid.uuid5(NS, 'user@example.com')
# same input -> same UUID, every time, in every languageTaking the first 32 hex characters of a SHA-256 and inserting hyphens produces something that looks like a UUID and fails strict validation, because the version and variant nibbles are wrong.
Pick and freeze a namespace
The namespace separates contexts, so the same string in two systems does not collide. RFC 9562 defines DNS, URL, OID and X.500; for application data, generate one v4 and hard-code it.
Treat that constant as part of your schema. Changing it changes every derived identifier, which is a data migration rather than a config tweak.
Where it pays off
Idempotent imports — re-running a load updates existing rows instead of duplicating them, with no lookup table.
Cross-service agreement — two systems derive the same id for the same entity without coordinating.
Content addressing — deriving an id from a normalised file path or a canonical URL.
Normalise the input first
The hash is over exact bytes, so User@Example.com and user@example.com produce different UUIDs. Lowercase, trim, and apply Unicode normalisation (NFC) before hashing, and document the rule — anyone recomputing the id must apply the same steps.
And remember the identifier is not secret: anyone knowing the namespace and the input can compute it. Never use a v5 UUID as an access token.
Frequently asked questions
Which version generates a UUID from a string?
v5 (SHA-1) or v3 (MD5). Prefer v5.
Can I use SHA-256 and format it as a UUID?
Not correctly — the version and variant bits would be wrong and strict validators reject it.
What happens if I change the namespace?
Every derived UUID changes. Treat the namespace as a fixed schema constant.
Ready to try it?
Open the free browser-based UUID generator and apply what you just read — no sign-up, runs locally.
Open the UUID generator tool