Security

Random Token Generator

Live

Generate a fresh random token from 8–128 browser-created bytes and encode it as hex, Base64, or Base64URL.

About Random Token Generator

Create a random token locally for session identifiers, webhook secrets, test credentials, and other systems that accept opaque random values. Choose the byte count and required text encoding, then copy the result directly to its destination.

Set up Random Token Generator

Workspace

Output studio

Shape the options below, then create a fresh output from the selected ingredients.

Complete the fields to prepare a result.

Choose how many random bytes of entropy the token should contain; 32 bytes is suitable for many secrets.

Choose the text-safe encoding required by the system that will receive the token.

Random Token Generator: token

Choose the values that apply, then generate random token.

Generation method

Generate the requested bytes with Web Crypto, encode without truncation, and report nominal entropy as bytes × 8 bits.

How it works

The browser fills a Uint8Array with crypto.getRandomValues, then encodes those bytes without reducing them. Hex uses two characters per byte; Base64 uses four characters per three bytes; Base64URL replaces URL-sensitive characters and removes padding.

Examples

Generate a 32-byte URL-safe token

Example input
{
    "bytes": 32,
    "encoding": "base64url"
}
Expected result
{
    "token": "4vNQ-Km1oE7zL2xYpR8uC5aW0sT9dH3bJ6fGqI2nMkc",
    "bytes": 32,
    "format": "base64url",
    "entropy_bits": 256
}

Privacy

Sensitive inputs stay on your device. Results are generated locally and are not stored by UtilityPages.org.

Citations & sources

  1. Web Cryptography Level 2: Crypto.getRandomValues

Frequently asked questions

Where is the token generated?

It is generated inside your browser with crypto.getRandomValues. The custom page marks the result as sensitive and does not send it to UtilityPages for generation or storage.

How many bytes should I choose?

Follow the receiving system’s documented requirement. When none is provided, 32 random bytes gives a nominal 256-bit space and is a common general-purpose choice, but format and rotation requirements still matter.

Which encoding should I use?

Use the exact encoding expected by the destination. Hex is widely compatible but longer; Base64 is shorter and may contain +, /, and =; Base64URL substitutes URL-safe characters and removes trailing padding.

Can I use this to generate encryption keys?

Use the key-generation facility specified by your cryptographic system instead. The Web Crypto specification explicitly distinguishes getRandomValues from generateKey, and key formats often require additional structure or handling.