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

Produces a deterministic result for documentation and tests. Never use a seeded result as a real secret.

Token 1
zifvuOO5--CCIztDh-xAyLXeiKU6UZHfsf_UuNVXJfA
Token 2
eZEHZ4Qu9QBFPKmMqZ-lvauqnpdhvpn2fw6gs4R7Dis
Encoding
base64url
Entropy per token
256 bits
zifvuOO5--CCIztDh-xAyLXeiKU6UZHfsf_UuNVXJfA
eZEHZ4Qu9QBFPKmMqZ-lvauqnpdhvpn2fw6gs4R7Dis

Supported formats

Input
number, select
Output
text, number

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

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

  1. Read the requested byte length, count and encoding.
  2. Draw the exact number of bytes from the platform CSPRNG.
  3. Encode the bytes with the standard alphabet for the chosen encoding.
  4. Report the entropy as byteLength × 8 bits, which is exact because each byte is uniform.

Usage

  1. Choose how many random bytes each token should contain.
  2. Pick the encoding you need for your protocol.
  3. 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

jsonSelect to copy
{
  "byteLength": 32,
  "count": 2,
  "encoding": "base64url",
  "seed": "example"
}

A 16-byte hex token

jsonSelect to copy
{
  "byteLength": 16,
  "encoding": "hex",
  "seed": "example"
}

A 20-byte base58 token

jsonSelect to copy
{
  "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

  1. RFC 4086: Randomness Requirements for Security — IETF
  2. RFC 4648: The Base16, Base32, and Base64 Data Encodings — IETF
  3. MDN Web Docs — Crypto.getRandomValues() — MDN