Random Token Generator
Generate cryptographically secure random tokens in hex, base64url, base32 and base58 encodings.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Generated 2 base64url token(s) from 32 random byte(s) (256 bits of entropy each).
How it works
- Read the byte length, count and encoding.
- Drew that many bytes from the platform CSPRNG.
- Encoded the bytes as base64url.
- Reported the exact entropy, which equals the byte length because every byte is uniform.
- The entropy of a token is fixed by its byte length; the encoding changes the text, not the randomness.
- Generated tokens stay in your browser and are never sent or stored.
Methodology
- Read the requested byte length, count and encoding.
- Draw the exact number of bytes from the platform CSPRNG.
- Encode the bytes with the standard alphabet for the chosen encoding.
- Report the entropy as byteLength × 8 bits, which is exact because each byte is uniform.
Usage
- Choose how many random bytes each token should contain.
- Pick the encoding you need for your protocol.
- Generate one or more tokens and copy the value.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Two reproducible 32-byte base64url tokens
{
"byteLength": 32,
"count": 2,
"encoding": "base64url",
"seed": "example"
}A 16-byte hex token
{
"byteLength": 16,
"encoding": "hex",
"seed": "example"
}A 20-byte base58 token
{
"byteLength": 20,
"encoding": "base58",
"seed": "example"
}Limitations
Tokens are bearer secrets
A token's security is the randomness behind it plus the discipline of the system that accepts it. Store a hash of the token rather than the token itself, bind it to a subject and an expiry, and compare in constant time.
This tool gives you the random material and an exact entropy figure. It deliberately does not choose a token lifetime or a storage strategy, because those depend on your protocol.
Frequently asked questions
- How many bytes should a token have?
- 128 bits (16 bytes) is a common minimum for session or CSRF tokens; 256 bits (32 bytes) is comfortable for API and long-lived secrets. The tool reports the exact entropy so there is no guesswork.
- What is the difference between hex, base64url, base32 and base58?
- They encode the same bytes differently. Hex is longest and universally safe; base64url is compact and URL-safe; base32 is case-insensitive and used by some authenticators; base58 avoids visually ambiguous characters for human transcription.
- Is my token sent anywhere?
- No. Tokens are generated from `crypto.getRandomValues` in your browser; the page has no network or storage path.
Sources
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.