Skip to main content
AllDevToolsHub

UUID Generator

100% Local

Generate random UUIDs (v1, v4, v7) and ULIDs.

UUID Generator
Step 1

Select Version

Step 2

Quantity

Count1
Generated Resultsv4
Click generate to create unique identifiers...
PredictableNO

Time components

UniversalYES

ISO Standards

CollisionsZERO

Cryptographic scale

Try:

Privacy note

This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

How to Use UUID Generator

01

Choose UUID Version

Select v1 (time-based), v4 (random), or v7 (time-ordered). ULID is also available for sortable IDs.

02

Set Batch Count

Enter how many UUIDs to generate (1 to 1000). Bulk mode is useful for database seeding or test fixtures.

03

Generate and Copy

Click Generate. Copy individual UUIDs or the full batch to clipboard. Each generation uses Web Crypto for randomness.

UUID Generator: the essentials

AllDevToolsHub's UUID Generator is a free, browser-based tool that generates cryptographically random UUIDs (v1, v4, v7) and ULIDs using the Web Crypto API. No installation or account required, every ID is generated locally with no server roundtrip. Pick v7 or ULID for time-ordered database keys, v4 for unpredictable tokens, v1 only when interoperating with legacy systems that require MAC-based ordering. Batch mode lets you generate up to thousands of IDs at once for fixture data or schema seeding.

Key points

  • All IDs are produced from `crypto.getRandomValues()`, a CSPRNG seeded from the OS entropy pool, never the unsafe `Math.random()`, which is a deterministic xorshift PRNG.
  • UUID v7 (RFC 9562, 2024) prefixes a 48-bit Unix-millisecond timestamp before 74 random bits, giving B-tree indexes sequential inserts and 2–5× the write throughput of v4 on hot tables.
  • UUID v4 has 2^122 possible values, so by the birthday paradox you would need to generate ~2.71 × 10^18 IDs to reach a 50 percent collision chance, about 85 years at 1 billion per second.
  • ULIDs encode the same 128 bits as 26 Crockford Base32 characters that are URL-safe and case-insensitive, while UUIDs are 36 characters with hyphens that often need percent-encoding.

When to use it

  • Picking primary keys for a new PostgreSQL 17 table where `uuidv7()` provides chronological ordering without exposing the row count the way auto-increment integers do.
  • Minting idempotency keys for a payments API so clients can retry a charge request safely without risking double-billing if the network drops mid-response.
  • Generating unguessable share links for private documents where v4's 122 bits of entropy make brute-force enumeration of the URL space computationally infeasible.
  • Producing correlation IDs that thread through a distributed-tracing pipeline (OpenTelemetry, Datadog APM) where every span needs a globally unique identifier without coordination.

Common mistakes

  • Storing UUIDs as `VARCHAR(36)` when Postgres has a native `UUID` type, the string form doubles storage to 36 bytes, inflates indexes proportionally, and slows comparisons.
  • Using MySQL's built-in `UUID()` function as a primary key default, it produces v1 UUIDs whose random-looking layout scatters InnoDB clustered-index inserts and tanks write throughput.
  • Generating v4 tokens with `Math.random()` in a library that did not switch to `crypto.getRandomValues()`, the resulting session IDs are predictable and trivial to forge.
  • Treating UUID v7 as strictly monotonic within a millisecond; two v7 IDs generated in the same millisecond can sort in either order unless the library implements a monotonic counter.
Overview

What is UUID Generator?

Generate UUIDs in multiple versions: v1 (time-based), v4 (random), and v7 (time-ordered). Also supports ULIDs for sortable unique IDs, single or batch output.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

UUID Generator

Need a unique identifier? Our UUID generator supports various versions including v1 (time-based), v4 (random), and the new v7 (time-ordered). We also support ULIDs for sortable unique IDs. Generate single IDs or batch results in seconds.

RFC 9562 defines v4 (random) and v7 (time-ordered). This generator mints them with Web Crypto instead of a weak Math.random polyfill.

Create a v7 UUID. The first bytes encode a millisecond timestamp, so two generated a second apart sort lexicographically. v4 will not.

Use v4 for public unguessable tokens. Use v7 for database primary keys. v1 still leaks MAC addresses, avoid it.

01 ID Performance Benchmarks

Identifier Sortable Index Efficiency Storage Mode
Auto-IncrementYes100% (High)Int/BigInt
UUID v7Yes~85% (High)Binary(16)
ULIDYes~80% (High)Binary(16)
UUID v4No~40% (Low)Binary(16)

02 CSPRNG Generation Pipeline

1
Timestamp Extraction (v7/ULID) Extracts the 48-bit Unix-millisecond timestamp to ensure chronological sortability across records.
2
Entropy Injection Injects high-quality random bits via crypto.getRandomValues() to maintain collision resistance.
3
Version/Variant Tagging Final bit-manipulation to set the UUID version (e.g., 0100 for v4) and the RFC 9562 variant markers.

03 When You Need a UUID (and Which Version)

The choice between v4, v7, and ULID changes the performance characteristics of your entire database. Picking the wrong one on a fast-growing table is the kind of mistake you only notice at 100M rows, when it's expensive to fix:

  • 🗄
    Primary keys on a busy table → UUID v7 Sequential by millisecond, so B-tree inserts hit the right edge of the index instead of scattering. On a busy InnoDB table this is the difference between graceful growth and 5× write-amplification past 100M rows.
  • 🔐
    Public-facing tokens / share links → UUID v4 Unpredictable. A leaked v7 ID can be used to enumerate adjacent records ("the ID I have ends in Aw, let's try Ax, Ay, …"); v4 has 122 bits of entropy with no chronological adjacency.
  • 🔗
    URL paths that humans might type → ULID 26-character Crockford Base32, case-insensitive, no ambiguous characters (no I/L/O/U). 10 characters shorter than a UUID and safe in URLs without percent-encoding.
  • 🧱
    Idempotency keys for API requests → UUID v4 or v7 Either works. Stripe and most modern APIs accept any opaque unique string. Generate client-side, send in Idempotency-Key header, retry safely.
  • ⚠️
    Never: UUID v1 in anything user-visible v1 embeds the generating machine's MAC address (or a random node ID since RFC 4122 §4.5, still varies by library). Treats hardware identity as public. Use v7 for sortable-with-time semantics.

04 Worked Examples

EXAMPLE 1 · ANATOMY OF A UUID v7
0193e8c5-a7b2-7d4e-a8f9-1b2c3d4e5f60

└────timestamp────┘└v┘└──────random──────┘
48 bits 4 74 bits of rand


Bytes 0–5 (12 hex digits): Unix epoch milliseconds, big-endian. Reading 0193e8c5a7b2 as hex = 1735603200946 ms = 2024-12-30 22:00:00 UTC.


The 7 in position 13 is the version nibble. The leading bits of position 17 (here a = 1010) encode the RFC 9562 variant.


EXAMPLE 2 · v4 VS v7 SORT ORDER (SAME TIMESTAMPS)
Three IDs generated within ~10ms, v4:
e8c4-5f1a-7b2c-3d4e

4a9b-2e1f-8d6c-7a5b
b7e3-9c2a-1d4f-6e8d ← creation order randomized when sorted


Three v7 IDs generated within ~10ms:

0193e8c5-a7b2-7…
0193e8c5-a7b3-7…
0193e8c5-a7bc-7… ← lexicographic order = creation order

For a database index, v7's monotonic prefix means each new row appends to the rightmost B-tree page. Random v4s force splits on whichever page contains the random prefix.


EXAMPLE 3 · POSTGRES SCHEMA WITH v7
-- PostgreSQL 17+ ships uuidv7() built in

CREATE TABLE events (
id UUID PRIMARY KEY DEFAULT uuidv7(),
payload JSONB NOT NULL,
created TIMESTAMPTZ NOT NULL DEFAULT now()
);

-- On older Postgres, generate in the app layer or
-- use the pg_uuidv7 extension.
INSERT INTO events (payload) VALUES ('{"type":"signup"}');
SELECT id FROM events ORDER BY id LIMIT 5;
-- Returns rows in creation order without scanning the timestamp.


No second sort key needed for "most recent N events" queries, the primary key already sorts chronologically.




05 Related Tools

UUIDs share a problem space with other token formats. When v4 isn't quite right, one of these usually is:

You Might Also Need