UUID generator
Generate one or many random v4 UUIDs with a click, using the browser crypto API. Copy individually or all at once.
What this UUID generator does
Click once and get up to 100 fresh version 4 UUIDs, each produced by the
browser’s crypto.randomUUID(). They are lowercase, hyphenated, 36 characters
long and ready to paste into a database seed, a test fixture, a config file or
an API request. Every ID can be copied on its own, or the whole list can be
copied newline-separated. Generation is instant and local.
How to use it
- Set Count (1–100; the page starts with 5).
- Click Generate. Each click replaces the list with new values.
- Click Copy next to a single ID, or Copy all to grab the list, one UUID per line.
The input is clamped: 0 or a negative number produces one UUID, anything above 100 produces 100.
Anatomy of a v4 UUID
f47ac10b-58cc-4372-a567-0e02b2c3d479
│ │ │ │ └─ 12 hex (48 bits) random
│ │ │ └─ variant: first digit is 8, 9, a or b
│ │ └─ version: always 4 here
│ └─ 4 hex (16 bits) random
└─ 8 hex (32 bits) random
The groups are 8-4-4-4-12 hex digits = 32 hex digits = 128 bits, with 4 hyphens
making 36 characters. Only two positions are fixed (the version nibble and the
variant bits), which is how a regex like
^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
can validate a v4 UUID. The all-zero 00000000-0000-0000-0000-000000000000 is
the “nil” UUID and is never produced by a generator.
UUID versions compared
| Version | Built from | Sortable by time | Leaks | When to prefer it |
|---|---|---|---|---|
| v1 | 60-bit timestamp + clock sequence + MAC address | Roughly (byte order is awkward) | MAC address and creation time | Legacy systems only |
| v4 | 122 random bits | No | Nothing | Tokens, tests, keys where order does not matter |
| v5 | SHA-1 of a namespace + name | No | Nothing (deterministic) | Stable IDs derived from a URL or name |
| v7 | 48-bit Unix millisecond timestamp + 74 random bits | Yes, lexically and in binary | Creation time | Database primary keys, event logs, anything indexed |
This tool generates v4 only. If you need v7 in code, the uuid npm package
(uuidv7()), PostgreSQL 18’s uuidv7() and many ORMs provide it.
UUIDs as database keys
A random v4 key is fine until the table is large enough that the index no longer fits in memory. Because each new key is uniformly random, inserts touch random index pages, causing page splits and cache misses; v7 keys are monotonically increasing so inserts append. Practical rules:
- Store as 16 bytes, not 36 characters. Postgres has a native
uuidtype; MySQL and SQL Server useBINARY(16)/UNIQUEIDENTIFIER. Text storage more than doubles index size. - Do not strip the hyphens in APIs and logs; every parser expects them, and the compact 32-char form is a different representation.
- Use v4 when the ID is public and creation time is sensitive (invite links, unsubscribe tokens). v7 reveals when the row was created, down to the millisecond.
- Do not use a UUID as a secret on its own for anything long-lived — it is unguessable, but it is not a replacement for authentication.
Generating UUIDs in code
const id = crypto.randomUUID(); // browser (secure context) and Node 19+
In Node 14–18 use import { randomUUID } from 'node:crypto'. On the command
line, uuidgen (macOS, Linux) or PowerShell’s [guid]::NewGuid() produce v4
values; Linux also exposes /proc/sys/kernel/random/uuid.
Related tools and snippets
- Hash generator — a v5 UUID is a SHA-1 hash of a name; see what the raw digest looks like.
- Timestamp converter — decode the millisecond timestamp at the front of a v7 UUID.
- Number base converter — read the hex groups of a UUID as decimal or binary.
- Lorem ipsum generator — the other half of a test fixture: placeholder text to go with the IDs.
- JWT decoder — UUIDs commonly fill the
jtiandsubclaims.
FAQ
Are these UUIDs cryptographically random?
Yes. They come from crypto.randomUUID(), which draws from the operating system's CSPRNG — the same source used for session tokens and keys, not Math.random().
What is a version 4 UUID?
A 128-bit identifier with 122 random bits; the remaining 6 bits mark the version (the 4 at the start of the third group) and the variant (8, 9, a or b at the start of the fourth group). It is defined in RFC 9562, which replaced RFC 4122.
How likely is a collision?
With 122 random bits you would need to generate about 2.7 quintillion UUIDs to reach a 50% chance of a single duplicate. For any practical system, treat v4 UUIDs as unique without coordination.
Is a GUID the same as a UUID?
Yes. GUID is Microsoft's name for the same 128-bit format. .NET's Guid.NewGuid() produces v4 values; the only cosmetic difference is that some Windows tools print them in uppercase or wrapped in braces.
Should I use UUID v4 or v7 for database primary keys?
v7 if your database supports it: its first 48 bits are a millisecond timestamp, so new rows land at the end of a B-tree index and inserts stay fast. Random v4 keys scatter across the index and cause page splits at scale. v4 is still fine for small tables, tokens, and anywhere you do not want to leak creation time.
Why does crypto.randomUUID not exist in my code?
It requires a secure context — HTTPS or localhost — and is not available on plain http:// pages. It shipped in Chrome 92, Firefox 95, Safari 15.4 and Node 19 (Node 14.17+ via require('crypto')).