Random Token Generator

Generate cryptographically secure random tokens in multiple formats.

  1. Home
  2. > Hash & Security >
  3. Random Token Generator

Configuration

4 32 (Default) 128

Generated Tokens

Configure your token and click Generate.

Token Format Reference

Format Character Set Output Length (32 bytes) Use Case
Hex0-9 a-f64 charsAPI keys, hash representations
Base64A-Z a-z 0-9 + / =44 charsSecret keys, tokens (compact)
Base64 URL SafeA-Z a-z 0-9 - _43 charsURL-safe tokens, JWT secrets
AlphanumericA-Z a-z 0-9variesHuman-readable tokens, OTP
Numeric0-9variesPIN codes, OTP digits
UUID v40-9 a-f (fixed format)36 charsDatabase IDs, unique identifiers

Understanding Token Entropy

The security of a random token depends on its entropy, which is determined by the character set size and the token length. More entropy means more possible combinations and higher resistance to brute-force attacks.

Format Charset Size Default Entropy (32 bytes) Crack Time (1B/s)
Hex16256 bitsCenturies+
Base6464256 bitsCenturies+
Alphanumeric62~152 bitsCenturies+
Numeric10~106 bitsCenturies+
UUID v416 (122 bits)122 bitsCenturies+

Frequently Asked Questions

Is this token generator cryptographically secure?

Yes. This tool uses the Web Crypto API's crypto.getRandomValues() method, which is backed by the operating system's cryptographically secure random number generator (CSPRNG). The generated tokens are suitable for API keys, session tokens, CSRF tokens, and other security-sensitive applications.

How long should an API key be?

For API keys, a minimum of 128 bits of entropy is recommended. This corresponds to a 32-character hex token (32 bytes = 256 bits). If using Base64, aim for at least 24 bytes (32 characters). Most major API providers (Stripe, GitHub, etc.) use tokens in the 32–48 byte range.

What is the difference between UUID v4 and random tokens?

UUID v4 follows a specific format (xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx) where certain bits are fixed for version identification. This gives UUID v4 exactly 122 bits of randomness. Random tokens from other formats can have higher or lower entropy depending on length.

Why use Base64 URL Safe?

Standard Base64 includes + and / characters, which need URL-encoding when used in URLs. The URL-safe variant replaces these with - and _, making tokens safe for use in URLs, filenames, and HTTP headers without escaping.

Help2Code Logo
Menu