Skip to content
SimpleTools24

UUID v4 Generator

Create random version 4 UUIDs, the most widely used kind of UUID, one at a time or in bulk. Every value is generated locally with your browser’s secure random number generator.

1 to 1,000.

Output format

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

Choose your options and press Generate. Identifiers are created in your browser.

What Makes a UUID Version 4?

RFC 9562 defines version 4 as a UUID built from random or pseudorandom data. Of its 128 bits, 4 hold the version number and 2 hold the variant; the other 122 are random (RFC 9562 §5.4 (opens in a new tab)). That fixed structure is why every v4 looks like xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx, where N is 8, 9, a or b.

Because nothing else is encoded, a v4 UUID reveals nothing about when or where it was made. That’s a privacy advantage over time-based versions, and RFC 9562 recommends v4 when UUIDs are involved in any security-related operation, while still warning that UUIDs shouldn’t be treated as unguessable secrets (RFC 9562 §8 (opens in a new tab)).

When to Use UUID v4

  • Public resource IDs in URLs and APIs, where sequential numbers would reveal how many records exist.
  • Correlation and request IDs in logs and tracing.
  • File names, upload keys and cache keys.
  • Test data and fixtures, using the bulk options above.

If you’re choosing a primary key for a large, insert-heavy table, compare it with the time-ordered UUID v7. RFC 9562 notes that non-time-ordered UUIDs such as v4 have poor database-index locality (RFC 9562 §2.1 (opens in a new tab)).

UUID v4 vs v7 at a Glance

  • Randomness: v4 has 122 random bits; v7 has 74, after a 48-bit timestamp.
  • Ordering: v4 has none; v7 sorts roughly by creation time.
  • Information revealed: v4 reveals nothing; v7 reveals approximately when it was generated.

The v7 generator shows the embedded time for each ID, and the main GUID generator covers every version side by side.

UUID v4 in Popular Languages

All of these are built in and return version 4:

JavaScriptBrowsers (HTTPS) and Node.js
crypto.randomUUID();
C#
Guid.NewGuid();
Python
import uuid
uuid.uuid4()
Java
java.util.UUID.randomUUID();

Sources: MDN (opens in a new tab), Microsoft Learn (opens in a new tab), Python docs (opens in a new tab), Java SE docs (opens in a new tab).

Frequently Asked Questions

What is a UUID v4?

A version 4 UUID is a 128-bit identifier in which 122 bits are random and 6 bits record the version (4) and the variant. It carries no timestamp, machine or name information.

How can I tell if a UUID is version 4?

Look at the first digit of the third group: it is 4. The first digit of the fourth group is 8, 9, a or b, which marks the standard variant. The UUID validator checks both for you.

Is UUID v4 random enough for database IDs?

For uniqueness, yes. The trade-off is ordering: random values land at scattered positions in a B-tree index, which can slow inserts on very large tables. UUID v7 was designed to improve this.

Does crypto.randomUUID() create version 4?

Yes. It returns a version 4 UUID in browsers (secure contexts such as HTTPS) and in current Node.js.

Can I use a UUID v4 as an API key or password reset token?

Not as your only protection. RFC 9562 says UUIDs should not be assumed hard to guess. Use a dedicated secure token and check permissions on the server.

Why do some generators produce uppercase UUIDs?

Case is presentation only; the standard allows uppercase, lowercase or mixed. Microsoft tools often show uppercase GUIDs. Choose the case your system expects.

Sources