Developer ToolsGeneratorsFree Tool

UUID Generator v4

Generate a random RFC 4122 version 4 UUID with the version and variant bits set correctly.

How to Use UUID Generator v4
  1. 1Click Process to generate a new UUID v4
  2. 2Copy the result
  3. 3Click Process again for another random UUID
About UUID Generator v4

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.

Frequently Asked Questions

Each hex digit is randomly generated, and the version (4) and variant bits are set correctly per RFC 4122 — giving the standard UUID v4 shape with effectively no collision risk in practice.

Yes for most purposes — UUID v4 is widely used as a primary key format. If you specifically need cryptographically unpredictable IDs for security purposes (like session tokens), the API Key/Token Generator uses crypto.getRandomValues rather than Math.random.

v4 is fully random; v1 (a separate tool on this site) encodes the current timestamp plus a random node identifier, making it roughly sortable by creation time but revealing when it was generated.

No — generation happens entirely in your browser.

More from Developer Tools