CalculatorsConvertersDeveloperTextAll toolsDirectory
Submit your tool Sign in
Theme
Home/Answers/Developer
How-to

How do I generate a UUID v4?

Short answer

Use a browser-based UUID generator that creates version 4 UUIDs on your device using the browser's cryptographically secure random source. Each id has 122 random bits, so collisions are not a practical concern, and because generation is local nothing is logged anywhere.

What makes a v4 UUID safe to use

A version 4 UUID is a 128-bit value where 122 bits are random, formatted as the familiar 8-4-4-4-12 hex string. With that much randomness the chance of two independently generated ids colliding is astronomically small, which is why v4 is the default choice for database keys, request ids and correlation ids. Modern browsers generate them locally with the secure random source built into the platform.

When to consider v7 instead

UUID version 7, standardized in RFC 9562, starts with a millisecond timestamp before the random bits. That makes ids sort roughly by creation time, which databases like for index locality. If your ids end up as primary keys in a large table, v7 is worth a look; for everything else, v4 remains the simple default. Both can be generated in the browser.

Step by step

  1. Open the generator. Open the UUID generator in your browser.
  2. Generate. Create one or many v4 UUIDs instantly, all generated locally.
  3. Copy. Copy the ids you need straight from the page.

Frequently asked questions

Can two UUIDs collide?

In theory yes, in practice no. A v4 UUID has 122 random bits, so the collision probability is negligible for any realistic workload.

Are the UUIDs generated on a server?

No. They are generated in your browser with a cryptographically secure random source, and never transmitted.

What is the difference between v4 and v7?

v4 is fully random; v7 begins with a timestamp so ids sort by creation time, which helps database index performance.

Related answers