UtilToolkits2025-12-13
TL;DR — The UUID Generator produces RFC 4122 v4 (purely random) and v7 (time-ordered) UUIDs in your browser. Use v4 for tokens, secrets, and ad-hoc IDs; use v7 for database primary keys where index locality matters. For hashing or random integer needs, see the Hash Generator and Random Number Generator.
Integer primary keys (1, 2, 3, …) work on a single SQL server. In a modern distributed setup — read replicas, sharding, offline-first mobile apps, multi-region writes — they fall over for three reasons:
/orders/4823 tells competitors your total order count. Incrementing by 1 makes scraping trivial.A UUID is a 128-bit identifier, usually printed as 32 hex characters with dashes: 550e8400-e29b-41d4-a716-446655440000. The version digit (the first character of the third group) tells you how it was generated.
| Version | How it’s built | Use it for |
|---|---|---|
| v1 | Timestamp + MAC address | Avoid — leaks the host MAC. Legacy only. |
| v4 | 122 bits of random data | Tokens, secrets, session IDs, anywhere unpredictability matters |
| v7 | 48-bit Unix ms timestamp + 74 random bits | Database primary keys — sortable and index-friendly |
The pragmatic rule: v4 for tokens, v7 for primary keys. v7 was added to RFC 9562 in 2024 specifically because v4’s pure randomness destroys B-tree index locality and tanks insert performance on large Postgres / MySQL tables. v7 keeps the uniqueness guarantees but sorts naturally by creation time.
// JavaScript / Node 19+
crypto.randomUUID();
// → '550e8400-e29b-41d4-a716-446655440000'
// Python 3
import uuid
uuid.uuid4()
// PostgreSQL 13+
SELECT gen_random_uuid();
// PostgreSQL 18+ (v7)
SELECT uuidv7();
Math.random(). It’s not cryptographically secure and collisions become real at scale. Always use the platform’s crypto.randomUUID().UUID column type — half the storage and faster comparisons.The UUID Generator uses your browser’s built-in crypto.getRandomValues() API — the same CSPRNG that backs TLS in Chrome and Firefox. No network call, nothing logged, works offline.
With v4, the chance of collision among 1 billion generated UUIDs is roughly 1 in 1018. For all practical purposes, yes.
None functionally — GUID is Microsoft’s name for the same 128-bit identifier. The generator output works in both ecosystems.
UUID v7 is now standardized in RFC 9562 and supported natively in major databases. ULID gave us most of v7’s benefits earlier, but v7 is the modern answer.
Yes — load the page once, then disconnect. Generation uses local randomness only.