Token Generator
Generates a random string from a chosen character set — for temporary passwords and invite codes.
Generate random tokens and strings online — pick the length (1-512) and character set (uppercase, lowercase, digits, symbols). Free, instant, nothing leaves your browser.
Steps and notes
What is Token Generator?
A token is only as strong as the randomness behind it, and browsers have exactly one source worth using: the Web Crypto API's cryptographically secure generator, which this tool uses, not a predictable state machine — such generators have ended more than one session-handling project. Two properties decide whether a token is fit for its job. Length-times-alphabet gives entropy in bits: 32 characters from a 62-character set carries about 190 bits, far past the 128-bit floor for anything security-relevant; a 6-character password from the same set does not. Character-set choice should match the consumer: URL and cookie values want unreserved sets (letters, digits, dash) so nothing needs escaping; base64 tokens are fine in bodies but their +/= characters break in URLs unless made URL-safe. The subtler property is uniformity: drawing random bytes and mapping them with a modulo introduces bias when the alphabet size does not divide 256 evenly — the standard fix is rejection sampling, which this tool applies, so every character position is exactly uniform. Finally, match the token to its role: opaque session tokens can be raw random; secrets that humans copy should avoid look-alike characters; API keys benefit from a recognizable prefix so scanners can find leaks.
- Set the length
- Tick the character classes you need
- Click generate and copy
- This uses a regular random number generator; for security-sensitive cases use the platform cryptographic source
Frequently asked questions
- Is this different from just rolling random numbers?
- Yes — it reads from the browser cryptographic RNG (CSPRNG), not a predictable generator. Predictable ones have produced guessable session tokens in real incidents.
- How long should my token be?
- Count entropy bits: length × log2(alphabet size). Security values want at least 128 bits, which is roughly 22 characters from a 64-set or 32 from lowercase+digits.
- Why do some tokens contain characters that break URLs?
- Base64 uses + / =, which are reserved in URLs. For URL or cookie use, pick the alphanumeric set or URL-safe base64 so no escaping layer can corrupt the value.
- Can I reuse the same token generator for passwords?
- Technically yes, practically mind the alphabet: passwords typed or read aloud need reduced character sets, while machine secrets should keep the full uniform set and more length.
Category: Crypto
ID generators workflow
UUID Generator — v4, v1, v3, v5 and NIL IDs → ULID Generator — Time-Ordered, Sortable IDs Online → Nano ID Generator — Short, URL-safe Unique IDs Online → Token Generator → Password Generator → OTP code generator → BIP39 passphrase generator