v4 vs v7 — which to use in 2026
v4 is 122 random bits plus 6 version/variant bits. Random throughout — great for opaque identifiers where order must not leak, bad for database primary keys (random insertion order destroys B-tree locality).
v7 (RFC 9562, 2024) puts a 48-bit Unix millisecond timestamp at the front, followed by random bits. Lexicographic sort = time sort. Use v7 for database primary keys, event IDs, log IDs, anything where you want "insert order ≈ creation time." Most new schemas in 2026 default to v7.
How to use
- Pick version (v4 default).
- Pick count (1–10,000). 10 is a common need for quick local testing.
- Toggle formatting — uppercase, no dashes (the 32-char hex form), or braces (.NET Guid style).
- Copy all, or export as JSON array, CSV, or SQL VALUES clause for direct paste.
How random is this?
Uses crypto.randomUUID() (native v4) and crypto.getRandomValues() for v7
entropy — both cryptographically secure, backed by your OS's CSPRNG. Collision probability for v4:
after generating 1 billion UUIDs, the chance of any collision is about 1 in 2¹⁸ — which means never
in practice.
When to use a UUID (and when not to)
- Yes: distributed systems primary keys (no coordination), public-facing IDs where you don't want sequential enumeration, idempotency keys, request IDs.
- No: URLs where short slugs would be friendlier (
abc-123beats01928f9c-9e42-7d3f-a7e1-...), cases where you'd rather have a monotonic counter, anything where size matters (UUIDs are 128 bits).
FAQ
Why not v1 or v5?
v1 leaks MAC address + timestamp (privacy leak). v5 is for namespace-based IDs (rare). v4 and v7 cover ~99% of real use.
Can I use these as primary keys in MySQL?
v7, yes — use BINARY(16) for storage. v4 works but will fragment your clustered index. Either way, store as bytes, not VARCHAR.
Is this offline?
Yes. All randomness comes from your browser's CSPRNG. No network activity.
Related tools
- JSON Formatter — Format, validate, and beautify JSON online. 100% client-side — your data never leaves your browser.
- Base64 Encoder / Decoder — Encode and decode Base64 strings and files. Client-side, safe for sensitive data.
- Timestamp Converter — Convert Unix timestamps, epoch seconds/milliseconds, and ISO 8601 dates.
- Hash Generator — Generate MD5, SHA-1, SHA-256, and SHA-512 hashes client-side.
Pillar
Part of Encoding & Crypto — Base64, URL, JWT, hashes, UUID, QR, password.
Written by Mian Ali Khalid. Last updated 2026-04-25.