Random Token Generator
Generate a cryptographically secure random token. Choose how many bytes of entropy you want and the output format. Everything runs in your browser.
How to generate a random token
- Set the number of random bytes you want, from 1 to 256.
- Pick a format: hex, base64url or standard base64.
- Click Generate, then copy the token for your app or config.
Examples
32-byte API key in hex
bytes: 32, format: hex
a 64-character lowercase hex string, e.g. 9f8c...e21a
Frequently asked questions
What is a token used for?
Tokens are random strings used as API keys, secret keys, session identifiers, CSRF tokens, password reset links and one-time codes. The randomness makes them hard to guess.
What is the difference between hex and base64url?
Both encode the same random bytes. Hex uses 0-9 and a-f and is twice as long as the byte count. base64url is shorter and uses A-Z, a-z, 0-9, plus '-' and '_', so it is safe to put in URLs and filenames.
How many bytes should an API key or secret be?
32 bytes (256 bits) is a strong, common default for API keys and secrets. Use 16 bytes (128 bits) for shorter tokens and 64 bytes for high-value, long-lived secrets.
Is this token generator secure?
Yes. It uses the browser's built-in cryptographic random source, crypto.getRandomValues, the same CSPRNG used for keys and nonces. It is not a predictable Math.random output.
Is my token sent anywhere?
No. Tokens are generated locally in your browser and are never uploaded, logged or stored. Refresh the page and they are gone.
Why does the base64 output sometimes end in '=' but base64url never does?
Standard base64 pads its output to a multiple of four characters with '='. base64url drops that padding so the string is clean for URLs, which is why the two formats can differ in length.
Related tools
Password Generator
Generate strong, random passwords online. Choose length, letters, digits, symbols and skip look-alike characters. Created in your browser, never stored.
UUID Generator
Generate random version 4 UUIDs online. Create one or thousands at once, with uppercase or no-hyphen options, then copy them. Free and private.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.
Base64 Decode
Decode Base64 to plain text online. Paste a Base64 or base64url string and get instant UTF-8 output. Free, fast and runs in your browser.