UUID Generator
Generate one or more random RFC 4122 version-4 UUIDs — the 128-bit identifiers used for database keys, request IDs and file names.
How it works
format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx · the 13th hex digit is fixed to 4 (version), and y is one of 8, 9, a or b (variant) · the other 122 bits are random
A version-4 UUID is a 128-bit identifier that is almost entirely random: 122 of its bits are drawn at random, while six bits are fixed to mark it as "version 4, variant 1". Written as 32 hexadecimal digits in the 8-4-4-4-12 pattern, the third group always starts with 4 and the fourth group always starts with 8, 9, a or b. With 2^122 possibilities, you could generate a billion UUIDs a second for a century and still have a vanishingly small chance of a collision — which is why they are the default for distributed database keys, request tracing and unique file names.
Worked example
A generated value looks like 3f2504e0-4f89-41d3-9a0c-0305e82c3301: eight digits, then 4f89, then 41d3 (the 4 marks version 4), then 9a0c (the 9 marks the variant), then twelve more digits. Ask for five and you get five independent identifiers with the same fixed structure.
Sources: RFC 4122 — UUID URN namespace
Frequently asked questions
Are these UUIDs safe to use as secret tokens?
No. They are generated with Math.random, which is fine for test data, database keys and dev use but is not cryptographically secure. For session tokens, password-reset links or anything an attacker might try to predict, use a cryptographic random source such as crypto.randomUUID or a dedicated secrets library.
Can two version-4 UUIDs ever collide?
In principle yes, in practice effectively never. With 122 random bits, the probability of a duplicate stays negligible until you have generated on the order of a quintillion of them. For any normal application you can treat them as unique without a central registry.
What do the version and variant digits mean?
The 13th hex digit encodes the version — 4 means "random". The 17th digit encodes the variant, and for the common RFC 4122 layout its top bits force it to 8, 9, a or b. Those fixed digits are how software recognises a well-formed version-4 UUID.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.