Secure Token Generator

← Security Tools

Generate cryptographically random bytes as hexadecimal or Base64URL text.

SecurityRandom TokenBrowser crypto

How to generate random token material

  1. Choose 8–64 random bytes. The default is 32 bytes.
  2. Select hexadecimal or Base64URL and click Generate Token.
  3. Copy the result into your test workflow. Switching format preserves the same bytes; clicking Generate Token creates a fresh value.
  4. Use Reset to clear the displayed token. Changing the byte count also clears the previous result.

This tool is useful for exploring token formats and preparing test data. It generates random material, not a signed JWT, an issued API credential, or a registered password-reset link. For production credentials, generate and manage secrets inside a trusted application or secrets-management workflow.

Bytes versus characters

Each byte contains eight bits. Hexadecimal uses two characters per byte. Base64URL uses letters, digits, hyphens and underscores; this tool omits trailing padding. The two formats encode the same underlying bytes and do not change their randomness.

Random bytesBitsHex charactersBase64URL characters, unpadded
8641611
161283222
322566443
6451212886

For other lengths, hex length is 2 × bytes and unpadded Base64URL length is ceil(4 × bytes ÷ 3). Encoding is reversible, not encryption. A longer encoded string does not necessarily contain more random bytes. Confirm your receiving system’s required format and length before using a value. See RFC 4648 for the encoding definitions.

Randomness and security limits

The generator requires crypto.getRandomValues(). It stops with an error if the browser cannot supply random bytes and never substitutes Math.random. The displayed bit count describes random material; it is not a certification of the browser, device, or application.

The generator script does not upload tokens or store them in browser storage. Copying puts the value on your clipboard, where other software may access it. Reset clears this page’s result, but cannot erase screenshots, clipboard history, or copies already made. Treat secret tokens as credentials and avoid publishing them.

Does a generated token expire or grant access?

No. Expiration, access permissions, server-side validation, rotation and revocation belong to the application using it. This page does not register a token with any service.

Are two generated tokens guaranteed to differ?

No. Random selection can repeat. Applications that require uniqueness should enforce it when registering tokens. Choose the byte count according to the application’s threat model; the minimum option is not a universal recommendation.

Related tools

Use the API Key Generator for a fixed character alphabet with an optional prefix, or the Random String Generator to select character classes. Browse Security Tools for related tasks.