01UUID, the identifier that never collides
A UUID (Universally Unique IDentifier) is a 128-bit number written as 36 characters (8-4-4-4-12 hex). Its promise: two machines that never communicated can generate identifiers without ever clashing — the space is so vast (2¹²⁸) that collision is statistically impossible. Ideal for distributed database keys, filenames, API identifiers.
v4 is purely random (122 bits of entropy) — the universal standard. v7 (RFC 9562, 2024) starts with the millisecond timestamp: identifiers sort naturally by creation date, which makes database indexes far more efficient than with scattered v4s — its main selling point.
02The versions in brief
- v4
- 122 random bits. Leaks nothing, unpredictable. The default choice wherever ordering does not matter.
- v7
- 48 bits of timestamp (ms) + 74 random bits: chronologically sortable, perfect as a primary key. Reveals the creation instant — rarely a problem, worth knowing.
- v1
- The ordered ancestor: timestamp + the machine's MAC address. Leaks hardware identity — superseded by v7.
- v5 / v3
- Deterministic: derived from a name and a namespace (SHA-1 / MD5). The same name always yields the same UUID.
- NIL / Max
- 00000000-0000-0000-0000-000000000000 and ffff…ffff: reserved special values, useful as sentinels.
03From the command line
The same URL returns one raw v4 UUID — a dependency-free helper for scripts:
$ curl its-my-ip.com/uuid 3d9c2f1a-8b4e-4c7d-9e2a-6f1b0c5d8e7f
04Frequently asked questions
Can two v4 UUIDs collide?
With 122 bits of entropy, you would need to generate about 2.7 quintillion UUIDs to reach a 50% chance of one collision (birthday paradox). At one million UUIDs per second, that takes 86,000 years. In practice: no — and if your system sees one, look for a broken random generator, not bad luck.
v4 or v7 as a database primary key?
v7. v4s insert at random positions of the B-tree index, fragmenting pages and thrashing the cache on large tables. v7s, increasing over time, append at the end of the index like an auto-increment — while remaining generatable by any client without coordination. That is precisely why v7 was standardized.
Can a UUID serve as a secret (token, private link)?
A v4 from a cryptographic generator (as here, and as crypto.randomUUID) holds 122 bits of unpredictable entropy: technically enough. Two caveats: a v7 reveals its date and reduces entropy to 74 bits; and many systems log UUIDs without treating them as sensitive. For a real secret, prefer a longer dedicated token — see our password generator.
Why do the 4 and the 8/9/a/b always appear at the same positions?
Those are the format's fixed bits: the first digit of the 3rd group encodes the version (4 or 7), and the first of the 4th group encodes the “variant” (binary 10xx, hence 8, 9, a or b). A v4 UUID thus has not 128 but 122 bits of actual randomness — plenty.
05More tools
Dev & encoding
JWT decoderDecode a JWT and verify its signature, nothing ever sent Unix timestampConvert an epoch timestamp to a date and back, live Cron expressionsDecode a crontab expression and compute the next run times Base64Encode and decode Base64 (UTF-8, URL-safe), nothing ever sent MD5/SHA digestsCompute the hash of text or a file (MD5, SHA-256…), locallyMy IP & network — BGP / RPKI · Subnet · Port check
DNS & domains — DNS lookup · DNS propagation · Whois · Punycode / IDN
Email — Email score · Email check · Email headers · Blacklist · DMARC generator · DKIM key
Web & SEO — Page audit · HTTP headers · Security headers · Link preview · Robots.txt tester · TLS certificates · Redirects · Site down? · User agent
Privacy & passwords — WebRTC leak · Passwords · Password leak