UUID v3 produces deterministic identifiers from a namespace UUID and name string. It uses the MD5 hashing algorithm, so the same namespace and name always generate the same UUID value.
What is UUID v3?
UUID Version 3 is a name-based UUID format defined in RFC 4122. Unlike random UUIDs, UUID v3 values are deterministic. The UUID generator combines a namespace UUID and a name string, computes MD5, then adjusts the result so the identifier conforms to the UUID v3 layout.
550e8400-e29b-3d4c-8a2d-28aee8c68a55
└───────┘ └──┘ └───┘ └───────────────┘
namespace ver hash hash
3 (MD5)
How UUID v3 is generated
- Start with a namespace UUID and a name string.
- Concatenate the UUID bytes and the UTF-8 name bytes.
- Compute the MD5 hash of the combined bytes.
- Set the version bits to
0011and the variant bits to10. - Format the result as a standard UUID string.
When to use UUID v3
UUID v3 is useful when you need repeatable, deterministic UUIDs for the same logical entity, and when MD5 is acceptable. It is often chosen for cached identifiers, URL namespaces, and shared resources where the same input should always produce the same UUID.
Code examples for UUID v3
uuid npm package
Generate deterministic UUID v3 values in JavaScript.
# Install
npm install uuid
import { v3 as uuidv3, DNS } from 'uuid';
const id = uuidv3('example.com', DNS);
console.log(id);
Python standard library
Use the built-in uuid module for UUID v3 generation.
import uuid
uid = uuid.uuid3(uuid.NAMESPACE_DNS, "example.com")
print(uid)
google/uuid
Generate UUID v3 values from a namespace and name in Go.
# Install
go get github.com/google/uuid
package main
import (
"fmt"
"github.com/google/uuid"
)
func main() {
id := uuid.NewMD5(uuid.NameSpaceDNS, []byte("example.com"))
fmt.Println(id)
}
UUID Creator Java
Generate UUID v3 using a Java UUID library.
<!-- Maven dependency -->
<dependency>
<groupId>com.github.f4b6a3</groupId>
<artifactId>uuid-creator</artifactId>
<version>4.0.1</version>
</dependency>
import com.github.f4b6a3.uuid.UuidCreator;
import java.util.UUID;
UUID id = UuidCreator.getNameBasedMd5(UUID.fromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), "example.com");
System.out.println(id);
Manual MD5 helper
Create UUID v3 values in .NET without external libraries.
using System;
using System.Security.Cryptography;
using System.Text;
static Guid CreateUuid3(Guid ns, string name) {
var nsBytes = ns.ToByteArray();
Array.Reverse(nsBytes);
var nameBytes = Encoding.UTF8.GetBytes(name);
var hashInput = new byte[nsBytes.Length + nameBytes.Length];
Buffer.BlockCopy(nsBytes, 0, hashInput, 0, nsBytes.Length);
Buffer.BlockCopy(nameBytes, 0, hashInput, nsBytes.Length, nameBytes.Length);
using var md5 = MD5.Create();
var hash = md5.ComputeHash(hashInput);
hash[6] = (byte)((hash[6] & 0x0F) | 0x30);
hash[8] = (byte)((hash[8] & 0x3F) | 0x80);
Array.Reverse(hash, 0, 4);
Array.Reverse(hash, 4, 2);
Array.Reverse(hash, 6, 2);
var guidBytes = new byte[16];
Array.Copy(hash, guidBytes, 16);
return new Guid(guidBytes);
}
var id = CreateUuid3(Guid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), "example.com");
Console.WriteLine(id);
ramsey/uuid
Use Ramsey UUID for name-based MD5 UUID v3 values in PHP.
# Install
composer require ramsey/uuid
use Ramsey\Uuid\Uuid;
$id = Uuid::uuid3(Uuid::NAMESPACE_DNS, 'example.com');
echo $id->toString();
uuidtools gem
Create UUID v3 values in Ruby with MD5 name-based generation.
# Install
gem install uuidtools
require 'uuidtools'
namespace = UUIDTools::UUID.parse('6ba7b810-9dad-11d1-80b4-00c04fd430c8')
puts UUIDTools::UUID.md5_create(namespace, 'example.com')
uuid crate
Generate UUID v3 values in Rust with the uuid crate.
# Cargo.toml
[dependencies]
uuid = { version = "1", features = ["v3"] }
use uuid::Uuid;
fn main() {
let id = Uuid::new_v3(&Uuid::NAMESPACE_DNS, b"example.com");
println!("{}", id);
}
Elixir UUID package
Generate UUID v3 values in Elixir using a UUID library from Hex.
# mix.exs dependencies
{:elixir_uuid, "~> 1.2"}
UUID = Elixir.UUID
id = UUID.uuid3(:dns, "example.com")
IO.puts(id)
Erlang uuid library
Generate UUID v3 values in Erlang with a UUID dependency.
% rebar.config
{deps, [{uuid, "*"}]}
UUID = uuid:uuid3("6ba7b810-9dad-11d1-80b4-00c04fd430c8", "example.com").
io:format("~s~n", [UUID]).
SQL storage
UUID v3 values are deterministic and are usually generated in application code before insert.
CREATE TABLE items (
id UUID PRIMARY KEY,
name TEXT
);
-- Insert UUID v3 from your application
INSERT INTO items (id, name) VALUES ('5df41881-3aed-3515-88a7-2f4a814cf09e', 'example.com');
Frequently asked questions
Is UUID v3 deterministic?
Yes. UUID v3 always produces the same UUID for the same namespace and name combination.
Should I use UUID v3 or UUID v5?
Choose UUID v5 for stronger hashing with SHA-1, and use UUID v3 only when MD5 compatibility or legacy deterministic UUIDs are required.
Does UUID v3 expose private data?
UUID v3 does not expose the input name directly, but the generated UUID can be used to verify the input if the namespace and name are known. Avoid using sensitive names in public UUIDs.
Ready to generate? Open the UUID v3 generator →