Random token generator
This random token generator creates unpredictable strings for API keys, password reset links, CSRF tokens and other secrets. Developers use it when they need a quick, strong value without writing code.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
The short answer
Make a secure random token by reading bytes from a cryptographically secure random source and writing them as hex, Base64 or similar text. A 32-byte token carries 256 bits of randomness, which is far too many possibilities to guess by trial. Do not build tokens from Math.random, timestamps or user data.
FormulaBits of randomness = bytes x 8; hex length = 2 x bytes; Base64 length = 4 x ceil(bytes / 3)
Worked exampleBy default the tool makes 5 tokens of 32 random bytes (256 bits) in hex, so each token is 64 characters long and is built from bytes returned by crypto.getRandomValues; the values differ on every run.
Example
- Random bytes per token
- 32
- Format
- Hex (0-9, a-f)
- How many tokens
- 5
f82cabb542cbf13e275e5d07f66b9dd2a79a4b709f87a6be9829e0f1eef95667 72f7c8db9a2e5113d5aa245901a2c004e337ecf69a94502c0fb7e62ceb1ffb4c 969ac3212818c8dc59a37a8aa764901e785b6353007c94934cc3f62db6e83422 019dfef18d5af9a22c8b206258fafe6d87ffe26fbb10e37de02efbcfef167bc0 72614d5ae4a87f236c31b117d251f23cfde09243d207f6eaaf99155e22dcd031
How to use the random token generator
- Set Random bytes per token, from 8 to 128.
- Pick a Format: Hex, Base64, Base64url or Alphanumeric.
- Set How many tokens, from 1 to 100. New tokens appear as you change the settings, and Run makes a fresh set.
- Use Copy result or Download to save the tokens.
How it works
Bytes come from crypto.getRandomValues, the browser's cryptographically secure random source.
Hex uses 2 characters per byte, Base64 keeps = padding, and Base64url uses - and _ instead of + and / with no padding, so tokens fit in URLs.
Alphanumeric tokens use enough characters to carry at least as many bits as the chosen bytes, such as 43 characters for 32 bytes, and use rejection sampling so each of the 62 characters is equally likely.
The result is just the tokens, one per line, so they copy cleanly. They are made in your browser and are not sent or stored.
Everything runs in your browser. Your input is not uploaded or stored.
Questions and answers
How many bytes should a token have?
16 bytes (128 bits) is a common minimum for secrets and session IDs, and 32 bytes (256 bits) gives a wide margin.
What is the difference between Base64 and Base64url?
Base64url replaces + and / with - and _ and drops the = padding, so the token can go in a URL or file name without escaping.
Is Math.random good enough for tokens?
No. Math.random is not designed for security and can be predictable. This tool uses crypto.getRandomValues instead.
Last updated November 1, 2026. Maintained by SnowRock. How our tools work
All 220 SnowRock tools