UUID Generator v4
Generate a random RFC 4122 version 4 UUID with the version and variant bits set correctly.
- 1Click Process to generate a new UUID v4
- 2Copy the result
- 3Click Process again for another random UUID
What a version 4 UUID is
A UUID (universally unique identifier) is a 128-bit value written as 32 hexadecimal digits in the pattern 8-4-4-4-12, for example 3f2b8c1e-9a4d-4b6e-8c21-5d7e0a9f1b34. In version 4, 122 of those bits are random; the other six are fixed to mark the version (the digit at the start of the third group is always 4) and the variant (the first digit of the fourth group is 8, 9, a or b). This tool generates them with crypto.getRandomValues(), the browser's secure random source.
Why use UUIDs
- Database keys that can be created by many servers or clients without coordinating a counter.
- Public identifiers that do not reveal how many records exist, unlike 1, 2, 3.
- Idempotency keys and request IDs for APIs and logs.
- Test data, file names and temporary tokens during development.
How unlikely is a collision?
With 122 random bits there are about 5.3 × 1036 possible values. You would need to generate roughly a billion UUIDs every second for decades before the chance of a single duplicate became meaningful. For practical purposes they can be treated as unique.
Things to consider
- Unique does not mean secret. A UUID is a good identifier, but do not rely on one as a password or an access token unless it came from a secure source and you treat it as a credential.
- Index performance. Random UUIDs scatter inserts across a database index, which can slow very large tables compared with sequential keys. Time-ordered UUID variants exist for this reason.
- Storage. Store them in a native UUID or 16-byte binary column where your database supports it, not as 36-character text, to save space.
- Case. UUIDs are case-insensitive. Pick one case, usually lowercase, and stick to it for comparisons.
Versions at a glance
Version 1 combines a timestamp and a machine identifier, version 4 is random, and the newer version 7 puts a timestamp first so that values sort by creation time. Version 4 is the usual default when you just need a unique ID.
Related tools: password generator for secrets and the Base64 encoder.