UUID Generator (Version 4)
Version 4 UUIDs are 122 bits of randomness with a fixed version and variant. These are generated by your browser's cryptographic random number generator, so they never travel across a network.
Generator Options
Values are produced locally using crypto.getRandomValues.
What the 128 bits actually contain
A version 4 UUID is not 128 random bits. Four bits are fixed to mark it as version 4, and two more encode the RFC 4122 variant, leaving 122 bits of actual randomness. That is why every v4 UUID has a 4 at the start of the third group and one of 8, 9, a or b at the start of the fourth. If you see a UUID without that pattern, it is not version 4.
Collision probability, honestly
With 122 random bits you would need to generate roughly 2.7 × 1018 UUIDs before reaching a one-in-a-billion chance of a single collision. For practical purposes that means never — but only if the randomness is genuinely cryptographic. UUIDs built from Math.random() have far less entropy than they appear to, and have caused real collisions in production systems. This page uses crypto.getRandomValues.
Version 4 is not always the right choice
Because v4 values are random, consecutive inserts land in unrelated places in a B-tree index, which fragments database indexes and hurts write throughput at scale. Version 7 UUIDs, standardised in 2024, put a millisecond timestamp in the high bits so they sort roughly by creation time while staying unique. If you are choosing a primary key for a large table, v7 or a database-native sequence is often the better answer.
Formats you will encounter
The canonical form is 36 characters, lowercase, with four hyphens. Microsoft tooling frequently wraps it in braces. The URN form prefixes urn:uuid: and appears in XML and RDF. Some databases store the bare 32 hex characters. All of these represent the same 128 bits, so converting between them is purely cosmetic.