Home/UUID v4 Generator
RANDOM · RFC 9562 · MOST COMMON VERSION

UUID v4 Generator

Generate random UUID v4 identifiers instantly — the most widely used UUID version, built entirely from cryptographically secure random bytes. Free, browser-only, no signup.

★ 100% Free🔒 Zero Server Calls✓ RFC 9562 Compliant

What Is It

UUID v4 Generator: What Is a UUID v4?

This UUID v4 generator produces the fully random variant of the UUID standard defined in RFC 9562 (formerly RFC 4122). Out of its 128 bits, 122 bits are randomly generated using a cryptographically secure random number generator, while the remaining 6 bits are fixed to mark the version (4) and variant.

Because it carries no embedded timestamp, MAC address, or other identifying information, UUID v4 is the safest default choice when you need a unique identifier that reveals nothing about when or where it was created.

Anatomy

UUID v4 Format

Every UUID v4 follows the same 8-4-4-4-12 hexadecimal pattern as other UUID versions, but two positions are fixed and instantly recognizable:

PositionValueMeaning
13th character4Always the digit 4 — marks this as version 4
17th character8, 9, a, or bVariant bits (RFC 9562 variant)
All other positionsRandom hex122 bits of cryptographically secure randomness

Example: f47ac10b-58cc-4372-a567-0e02b2c3d479 — notice the 4 and the a in fixed positions.

Comparison

UUID v4 vs UUID v7 — Which Should You Use?

 UUID v4UUID v7
Basis122 bits randomUnix ms timestamp + random
Sortable by creation timeNoYes
Best forTokens, secrets, opaque IDsDatabase primary keys
Database index performancePoor at scale (random inserts)Excellent (sequential-ish inserts)
Reveals creation timeNoYes (by design)
💡

Quick rule of thumb

If you don’t want anyone to infer when a record was created, or you’re generating an API token/secret, use v4. If you’re creating a new database primary key in 2026, most teams now default to v7 for its indexing benefits.

Code

Generate a UUID v4 in Code

JavaScript
const id = crypto.randomUUID(); // built into every modern browser and Node.js 19+
Python
import uuid id = uuid.uuid4()
Java
import java.util.UUID; UUID id = UUID.randomUUID();
PostgreSQL
SELECT gen_random_uuid();

Need more languages? See our full code guides for Python, Java, PHP, Go, Rust, and more.

FAQ

UUID v4 FAQ

Yes. A GUID (Globally Unique Identifier), as used in Microsoft/.NET and SQL Server, follows the same 128-bit format as a UUID. When a GUID is randomly generated, it is functionally identical to a UUID v4 — the terms are interchangeable in this case.
A UUID v4 has 122 bits of true randomness, giving roughly 5.3 x 10^36 possible values. Using a cryptographically secure random number generator, the probability of ever generating a duplicate is negligible even at billions of UUIDs per second.
You can, but it is no longer the recommended default in 2026. Because UUID v4 values are fully random, they insert in random order across a B-tree index, which fragments the index and slows writes at scale. UUID v7, which is time-ordered, is now the preferred choice for new primary keys.
UUID v4 is often used for session tokens and API keys because of its randomness, but it was not designed as a cryptographic secret. For anything security-critical, use a dedicated secret generator rather than relying on a UUID alone.