UUID Generator
Generated on your device with the browser's cryptographic RNG.
Generate cryptographically random version 4 UUIDs, one at a time or in bulk, in whichever format your system expects.
Anatomy of a v4 UUID
Take f47ac10b-58cc-4372-a567-0e02b2c3d479. The4 starting the third group is the version marker, and thea starting the fourth group encodes the variant — its top bits are always 10, so that character is only ever 8, 9, a or b. Every other hex digit is random.
That leaves 122 random bits out of 128. The hyphens carry no information; they exist purely to make the value readable, which is why the no-hyphen format is just as valid and stores in 16 bytes either way.
Which version to use
| Version | Based on | Use when |
|---|---|---|
| v1 | Timestamp + MAC address | Legacy — leaks hardware identity |
| v4 | Random | Default for public identifiers |
| v5 | Namespace + name (SHA-1) | Same input must give the same ID |
| v7 | Timestamp + random | Database keys needing sortable inserts |
Frequently asked questions
What is a version 4 UUID?
A 128-bit identifier where 122 bits are random and 6 are fixed markers identifying the version and variant. Because it carries no timestamp, MAC address or counter, it reveals nothing about when or where it was created — which is exactly why it is the default choice for public-facing identifiers.
Can two UUIDs collide?
In theory yes, in practice no. With 122 random bits you would need to generate roughly 2.7 quintillion UUIDs before reaching a one-in-a-billion chance of a single collision. Generating a billion per second, that is over 80 years. Every real-world duplicate traces back to a broken random source, not to bad luck.
Should I use a UUID as a database primary key?
It depends on the index. Random UUIDs scatter writes across a B-tree, which fragments the index and hurts insert performance at scale — a real cost in MySQL and SQL Server with clustered indexes. UUIDv7, which puts a timestamp in the high bits, keeps inserts sequential and is the better choice for new schemas that want both properties.
Are these generated securely?
Yes. They come from crypto.randomUUID() where available, falling back to crypto.getRandomValues() with the version and variant bits set correctly. Both draw from the operating system's cryptographic entropy pool, so the output is suitable for identifiers that must be unguessable, such as invite tokens.
Related tools
- Password GeneratorGenerate strong random passwords using your browser's cryptographic RNG, with a live strength estimate.
- Hash GeneratorCompute SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files using the Web Crypto API.
- URL Encoder & DecoderPercent-encode and decode URLs and query strings, with a breakdown of each URL component.