What is a UUID v4?
A UUID (Universally Unique Identifier) is a 128-bit identifier used whenever you need a value that's guaranteed not to collide β database primary keys, filenames, transaction IDs, and more. Version 4 is filled almost entirely with random bits and is generated here with the browser's built-in crypto.randomUUID() API, so collisions are effectively impossible.
When would I use a random hex token?
Use a hex token whenever you need an unpredictable value β API keys, session tokens, password reset links, and similar. It's generated with crypto.getRandomValues(), a cryptographically secure random number source, then converted to a hex string.
Frequently Asked Questions
Are the generated values stored on a server?
No. Everything is generated entirely in your browser and is never sent or stored anywhere.
Can two generated UUIDs collide?
Theoretically the probability isn't zero, but for UUID v4 it's practically negligible β even generating billions of them, the chance of a duplicate is vanishingly small.