UUID Generator
Generate UUIDs (v1, v4, v7) with customizable formatting.
The UUID Generator produces RFC-shaped identifiers in three flavors — v1 (time-based), v4 (random), and v7 (time-ordered) — in batches from 1 up to 10,000. Formatting is fully customizable: toggle uppercase hex, strip or keep hyphens for 32-char strings, or wrap results in braces for Microsoft-style {…} GUIDs. Results stream into a "Generated UUIDs (N)" pane ready to copy whole or download as a timestamped .txt file.
All randomness comes from the Web Crypto API's crypto.getRandomValues — never Math.random — so v4 values are cryptographically strong and v1/v7 time components blend real timestamps with random node and variant bits. Generation re-runs automatically when version, count, or formatting options change, and a "Generating…" spinner covers explicit Generate clicks. The card states "Runs locally — nothing is uploaded," and there is no uuid package under the hood.
How it works
lib/uuidGenerator.ts builds each version differently: v4 places a 4 in the version nibble and draws variant bits from 8|9|a|b over 32 random hex chars; v1 encodes Date.now() into timeLow/timeMid/timeHiAndVersion (version nibble 0x1000), sets clockSeq to 0x8000 | rand & 0x3fff, and appends a random 12-hex node; v7 writes BigInt(now) << 16n as a timestamp prefix with version nibble 7 and variant bit 0x80.
Formatting strips hyphens and wraps braces per the checkboxes; count is clamped to 1–10000 in the input handlers and regenerated via a setTimeout-0 effect. validateUuid checks the canonical lowercase hyphenated form with /^[0-9a-f]{8}-[0-9a-f]{4}-[1-7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i. Downloads save as uuids-{version}-{timestamp}.txt.
How to use
- Select Version: "v1 (Time-based)", "v4 (Random)", or "v7 (Time-ordered)".
- Set Count with the −/+ icon buttons or by typing (clamped to 1–10000).
- Toggle formatting checkboxes: "Uppercase", "Hyphens" (on by default), and "Braces".
- Click "Generate" (or wait — generation also re-runs automatically when any option changes; the button shows "Generating…" with a spinner).
- Review results in the "Generated UUIDs ({count})" textarea; the counter shows "{n} UUIDs generated".
- Click "Copy All" to copy the newline-joined list, or "Download" to save uuids-{version}-{timestamp}.txt.
- Click "Clear" to empty the results pane and any error message.
Tips
- v7 is time-ordered (timestamp first) — ideal for sortable database primary keys; v4 is pure random and v1 carries a wall-clock plus node.
- Turn off Hyphens for bare 32-char hex strings; add Braces for Microsoft-style {…} GUIDs used in Windows/COM contexts.
- Uppercase affects hex digits only (HEX_CHARS_UPPER) — punctuation and braces stay as-is.
- Crypto randomness comes from crypto.getRandomValues, not Math.random — safe for security-sensitive identifiers.
UUID Generator FAQ
How many UUIDs can I generate at once?
Count is clamped to 1–10000 in the number input handlers, so you can batch up to ten thousand per run.
Are v1 UUIDs truly time-based?
Yes — generateV1 encodes Date.now() into timeLow/timeMid/timeHiAndVersion and pairs it with a random clock sequence and node address.
Do you use Math.random?
No — randomHex and the variant/nibble picks all use crypto.getRandomValues from the Web Crypto API.
Is anything uploaded?
No — the card says "Generate UUIDs (v1, v4, v7) with customizable formatting. Runs locally — nothing is uploaded."
Credits
- Web Crypto API — Randomness for v1/v4/v7 generation in lib/uuidGenerator.ts; no uuid package dependency