Random Token Generator
Cryptographically random tokens -- hex, Base64/Base64url, or alphanumeric, sized in real bits of entropy, bulk generation, .env export.
What this tool does
Generates cryptographically random tokens -- suitable for API keys, session IDs, CSRF tokens, password-reset tokens, and any other secret that needs to be unguessable -- in hex, Base64, Base64url (URL- and filename-safe), alphanumeric (letters and digits only), or a custom alphabet you define yourself. The size control is in real bits of entropy, not just character count, since different output formats need different numbers of characters to carry the same amount of randomness.
How many bits do you actually need?
As a practical floor: 128 bits is the generally accepted minimum for anything that must resist guessing or brute force -- session IDs, CSRF tokens, password-reset links. 256 bits is the common recommendation for longer-lived secrets like API keys and signing secrets, where the cost of a compromise is higher and the token is worth extra margin. Below 128 bits, a token starts becoming a realistic brute-force target as hardware improves; there's rarely a good reason to go lower for anything security-sensitive.
Choosing a format
Hex is the safest universal choice -- every
character is unambiguous in a URL, a shell command, a JSON string,
or a database column, at the cost of needing twice as many
characters as raw bytes. Base64url packs the same
entropy into roughly a third fewer characters and is safe to use
directly in a URL path or query string (unlike standard Base64,
which can include +, / and padding
= that need escaping in a URL). Alphanumeric
avoids every special character entirely. A custom
alphabet is for when a system has its own exact
constraints -- digits only for a numeric code, a specific symbol
subset, anything you can type.
Prefix, grouping, and excluding look-alikes
A prefix (like the sk_live_ or
ghp_ style many real API keys use) is prepended to the
random part and isn't counted toward entropy -- it's a label, not a
secret. Grouping inserts a separator every N
characters for readability, license-key style
(XXXX-XXXX-XXXX), without changing the underlying
randomness. Exclude look-alikes drops characters
that are easy to misread or mistype when a human has to transcribe
a token by hand (I, l, 1,
O, 0) -- the same look-alike set the
Password Generator tool uses.
Why rejection sampling, not a simple modulo
The alphanumeric, alphanumeric+symbols and custom-alphabet
modes don't map each random byte onto the alphabet with a plain
modulo (byte % alphabet.length) -- that introduces a
small but real bias toward the low end of the alphabet whenever
256 isn't a multiple of the alphabet size. This tool uses
rejection sampling instead: random bytes that would introduce that
bias are discarded and redrawn, so every character in the output is
uniformly distributed with no statistical skew. A custom alphabet
is also automatically deduplicated before use -- a repeated
character in what you typed would otherwise silently double that
character's odds of appearing.
Export formats, QR, bulk, and history
Beyond copying the raw token, export it as a .env line, a shell export statement, a curl Bearer header, or a JSON object -- each with a configurable variable name. A QR code moves the current token to another device without typing it. Bulk generation produces up to 100 tokens at once, downloadable as a single text file. The history panel keeps the last 8 tokens generated this session, for getting back to one without regenerating it.
Privacy
Every token is generated with crypto.getRandomValues()
-- a cryptographically secure random source -- entirely in your
browser. The session history lives only in this tab's memory; it's
never written to localStorage or sent anywhere.
Nothing is sent to a server, and nothing is stored once you
navigate away.