What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit label written as 32 hexadecimal digits in five groups — 550e8400-e29b-41d4-a716-446655440000. The promise is in the name: two UUIDs generated anywhere, by anyone, at any time can be assumed to be different without a central authority checking. That is why UUIDs are the standard identifier for records created on distributed systems — mobile apps, microservices, offline-first databases — where a shared auto-increment counter is impossible.
This generator produces RFC-compliant UUIDs entirely in your browser. The randomness comes from crypto.getRandomValues, the same cryptographic primitive your browser uses for TLS sessions.
UUID v4 vs v1 vs v7: Which Should You Pick?
- v4 — the default choice. 122 fully random bits. No timestamp, no MAC address, nothing to correlate. Pick v4 whenever you just need unique IDs and have no strong opinion.
- v1 — time-based, the legacy format. A 60-bit Gregorian timestamp (100-ns ticks since October 1582) plus a clock sequence and a 48-bit random node. It encodes when an ID was made but sorts awkwardly because the timestamp bytes are split across the string. Still required by some older specs (Microsoft COM, some enterprise systems).
- v7 — the modern time-based format (RFC 9562). A 48-bit Unix-millisecond timestamp first, then 74 random bits. v7 IDs sort chronologically as plain strings, which makes them excellent for database indexes and log lines. If you want time-ordering, choose v7; use v1 only when a legacy spec demands it.
Why the Randomness Source Matters
Plenty of tutorials build UUIDs from Math.random() — do not. Math.random() is a fast but predictable pseudo-random generator: its output can be reconstructed from a couple of observed values, which is catastrophic if the UUID doubles as a secret (a download link, a password-reset token). crypto.getRandomValues is a cryptographically secure random number source seeded by the operating system. Every v4 UUID from this tool has its 122 random bits drawn from it, so generated IDs are unguessable as well as unique — safe to embed in URLs where guessability would be a security hole.
How Likely Is a Collision, Really?
For v4, the random space is 2¹²² ≈ 5.3 × 10³⁶. The famous birthday-paradox math says you would need to generate about 2.7 quintillion v4 UUIDs before the probability of even one collision reaches 50%. Put practically: a server generating a billion UUIDs per second for 85 years would still have a collision probability under 50% — and at realistic volumes the risk is not just negligible, it is unmeasurable. v7 gets the same guarantee from its 74 random bits plus the guarantee that IDs from different milliseconds cannot collide on the timestamp alone. In day-to-day engineering, treat UUID collisions as impossible and spend your worry elsewhere.
Hyphenated or Compact? Uppercase or Lowercase?
The canonical rendering is lowercase with hyphens — 8-4-4-4-12 — and that is what most validators, regexes, and databases expect. But both toggles exist for good reasons:
- Hyphens OFF gives 32 contiguous hex characters: useful for compact storage, URL path segments without percent-encoding concerns, or CSV columns where the dashes cause spreadsheet auto-formatting (Excel turning IDs into dates is a real bug).
- Uppercase ON matches environments that canonically uppercase (some .NET and Oracle contexts). Hex digits compare case-insensitively in every UUID implementation, so
ABandabare the same ID — just keep your convention consistent across systems.
UUIDs as Database Primary Keys
UUID keys trade index locality for global uniqueness. Random v4 keys land anywhere in a B-tree, which causes page splits and cache misses at scale — that is precisely the problem v7 solves: its leading timestamp makes new keys monotonic-ish, so inserts stay right-packed like an auto-increment while remaining globally unique and merge-safe. Common practice: v7 or v4 for externally visible IDs and cross-system merges; plain integers only when the dataset is small, single-writer, and never leaves one database.
If you store UUIDs in Postgres, use the native uuid type (16 bytes) rather than varchar(36) — half the storage, faster comparisons, and no quoting mistakes.
Step-by-Step: Using the UUID Generator
- Choose the count. 1, 5, 10, 50, or 100 UUIDs per batch — the output area scrolls for large batches.
- Choose the version. v4 for general use, v7 when you want time-sortable IDs, v1 for legacy compatibility.
- Set format toggles. Hyphenated on/off and uppercase on/off apply to the whole batch immediately.
- Copy All for the full newline-joined list (seed files, spreadsheets), or Copy First for a single ID.
- Regenerate whenever you want a fresh batch — nothing is cached server-side because there is no server involved.
Ready to Generate UUIDs?
You know which version fits your use case, why the cryptographic randomness source matters, why collisions are a non-issue, and how to format IDs for spreadsheets and databases. Scroll back up, pick a count, and copy a batch of cryptographically secure UUIDs in one click.
