FC

🆔 UUID v4 Generator

Generate cryptographically random UUID v4 identifiers instantly in your browser.

fc1b5f57-a069-4b62-ab6c-65ffb8fcd64c
78f3b99f-b6e2-401b-957e-340caa8ac5a1
cfbe9f8c-bcbe-4bd9-9017-7baf89e1e858
b45870f8-a72d-47d5-ac71-cf3b647b58d6
475bdd05-07b6-4fcd-8177-02956bc90587

UUID v4 Anatomy

fc1b5f57-a069-4b62-ab6c-65ffb8fcd64c

Format: 8-4-4-4-12 hex digits. The third group always starts with 4 (version). The fourth group starts with 8, 9, a, or b (variant).

What is the difference between UUID v1, v4, and v7?

v1 encodes the current timestamp and MAC address — temporal ordering but leaks infrastructure details. v4 is fully random (122 random bits) — reveals nothing about time or host, the most widely used version for database primary keys. v7 (RFC 9562, 2024) combines a millisecond timestamp prefix with random bits — gives you both randomness and sortability without leaking hardware details. For new systems in 2024+, v7 is worth considering for database performance. For existing systems: v4 is fine and universally supported.

What is a ULID and when should I use it instead of UUID?

A ULID (Universally Unique Lexicographically Sortable Identifier) encodes a 48-bit millisecond timestamp followed by 80 random bits in a 26-character Crockford Base32 string (e.g., 01ARZ3NDEKTSV4RRFFQ69G5FAV). Key advantages: ULIDs sort chronologically as strings (improving database index performance — new records insert at the B-tree end), they are URL-safe, and slightly shorter than hyphenated UUID format. Use ULIDs when insert order matters for performance or when you want IDs with an implicit timestamp.

How unique are UUID v4s — can I get a collision?

UUID v4 has 122 random bits, giving 2^122 ≈ 5.3 × 10^36 possible values. If you generate one billion UUIDs per second continuously for 85 years, the probability of any collision is approximately 50%. For any realistic application — even large-scale distributed systems generating millions of records daily — collision probability is so small it is effectively impossible. The scenario to avoid is using a broken or seeded random number generator rather than a true CSPRNG.

Should I use UUID or auto-incrementing integer as a database primary key?

Auto-incrementing integers: faster for sequential inserts in B-tree indexes, smaller storage (4-8 bytes vs 16 bytes for UUID), and simpler to work with. Downsides: expose object counts, make distributed ID generation without coordination difficult. UUIDs solve all three at the cost of index fragmentation and larger storage. Practical recommendation: use auto-increment for simple single-database applications. Use UUID v4 or v7 when you have distributed writes, need to generate IDs client-side before a database round-trip, or want to obscure record counts in public-facing URLs.

What is the nil UUID and when is it used?

The nil UUID is all zeros: 00000000-0000-0000-0000-000000000000. It is the UUID equivalent of null — representing 'no UUID' or an unset UUID field. The max UUID (ffffffff-ffff-ffff-ffff-ffffffffffff) serves a similar purpose in some systems. Neither is generated by this tool since they are special fixed values, not random. Use the nil UUID as a default value for a UUID column before assignment or as a sentinel in an API response indicating a field has not been set.

Can I use generated UUIDs in production immediately?

Yes. The output is valid RFC 4122 UUID v4 — the same format produced by uuid.v4() in Node.js, UUID.randomUUID() in Java, str(uuid.uuid4()) in Python, and crypto.randomUUID() in modern browsers. The format is xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where 4 is the version marker and y is 8, 9, a, or b for the variant. Copy any generated UUID directly into your application, database insert, or API call.

What dev tools pair with the UUID generator for building APIs?

The JSON Formatter structures request/response payloads containing UUIDs. The JWT Decoder inspects tokens where UUIDs appear as the sub (subject) claim. The Base64 Encoder encodes UUIDs for use in URLs or headers. The Fake Data Generator produces complete test records with realistic names and emails that you can pair with generated UUIDs as primary keys. All are in the Dev Tools section.

Complete Guide

📊 Key Data Points

UUID v4

Random UUID — 122 bits of randomness, ~5.3 * 10^36 possible values

UUID v7

Time-ordered UUID — millisecond precision timestamp in first 48 bits, sortable by creation time

RFC 4122

The UUID specification — defines version 1, 3, 4, and 5. Version 7 is from the newer RFC 9562.

UUID Generator — UUID v4 and v7 -- Complete USA Guide 2026

UUIDs (Universally Unique Identifiers) are 128-bit identifiers used as primary keys, session IDs, correlation IDs, and request tracing identifiers. Version 4 UUIDs are random; version 7 UUIDs are time-ordered and sortable by creation time — better for database primary keys.

This generator creates cryptographically random UUIDs in your browser.

**Long-tail searches answered here:** uuid generator online free v4, generate random uuid browser tool, uuid v7 sortable uuid generator free online.

For realistic test data with UUIDs, pair with Fake Data Generator.

🔬 How This Calculator Works

Generates UUID v4 (random, using window.crypto.getRandomValues() for cryptographic randomness) and UUID v7 (time-ordered, using the current millisecond timestamp in the high bits followed by random bits).

UUID v4 format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where y is 8, 9, a, or b. UUID v7 format: timestamp milliseconds encoded in the first 48 bits, followed by version bits and random bits — sortable chronologically while remaining unique.

✅ What You Can Calculate

UUID v4 (random)

Cryptographically random UUID using window.crypto.getRandomValues(). The most common UUID format for general use.

UUID v7 (time-ordered)

Time-ordered UUID where the first bits encode the millisecond timestamp. Sortable chronologically — preferred for database primary keys to avoid index fragmentation.

Batch generation

Generate multiple UUIDs at once for bulk record creation, test fixtures, or populating lookup tables.

Nil UUID reference

Shows the nil UUID (all zeros: 00000000-0000-0000-0000-000000000000) — the standard null/default UUID value.

🎯 Real Scenarios & Use Cases

Database primary keys

Generate UUID primary keys for your records. UUID v7 is preferred for database PKs because time-ordering reduces B-tree index fragmentation vs random v4.

Correlation IDs for request tracing

Generate a UUID at the start of each request to use as a correlation ID. Pass it through all service calls for distributed tracing.

Test fixture generation

Generate UUIDs for test fixtures and mock data. Using UUIDs as fixture IDs prevents ID collision between test runs.

Session and token IDs

Generate cryptographically random UUIDs for session IDs, CSRF tokens, and one-time-use codes where unpredictability is required.

💡 Pro Tips for Accurate Results

UUID v7 for database primary keys. UUID v4 generates random values that cause B-tree index fragmentation. UUID v7 encodes the timestamp in the high bits, so new records cluster near each other in the index — dramatically better write performance for large tables.

UUIDs are not sequential by default. UUID v4 is random — do not use them for ordering or pagination without a separate created_at column. Use UUID v7 or a separate timestamp if chronological ordering matters.

Store as BINARY(16) not VARCHAR(36). Storing UUIDs as text (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) uses 36 bytes. Storing as binary uses 16 bytes — 55% less space. Remove the hyphens and decode to binary before storing.

Version 1 vs 4 vs 7. Version 1 uses MAC address + timestamp (privacy risk, now deprecated). Version 4 is random (current standard for most uses). Version 7 is time-ordered random (preferred for database PKs).

🔗 Use These Together

🏁 Bottom Line

UUIDs are the most common globally unique identifier format. This generator creates cryptographically random v4 UUIDs and time-ordered v7 UUIDs for database primary keys. For realistic test data with UUIDs: Fake Data Generator.