Random String & Token Generator
Generate secure random strings, API keys and tokens with honest entropy
Choose a character set and select Generate.
Only options are remembered in this browser; generated strings are never saved or sent.
Need a password with policy rules? Use Password Generator
How to use
- 1.Choose a preset such as Alphanumeric, Hex or Base64URL-safe, or enter a custom alphabet.
- 2.Set the length and quantity, and turn on Avoid ambiguous for codes people type by hand.
- 3.Optionally add a prefix or suffix under Advanced, such as sk_.
- 4.Select Generate, then copy one string, Copy All or download a .txt file.
Random String & Token Generator
Generate random strings, API keys, secrets and invite codes in your browser. Every character is drawn uniformly with crypto.getRandomValues and unbiased rejection sampling, and the entropy shown is the real value for the alphabet you choose.
How entropy is calculated
Entropy is length × log2(alphabet size) bits, using the unique characters left after ambiguous characters are removed. A prefix or suffix is fixed text and adds no entropy. With Require each class, strings missing a class are redrawn, and the entropy is counted exactly over the strings that remain, so it is slightly lower. 128 bits or more is a common target for API keys and session tokens.
Limits and privacy
Length 1–1024, quantity 1–100, custom alphabet up to 4096 code points and prefix or suffix up to 64. Custom alphabets are split by Unicode code points, so an emoji built from several code points counts as several characters. Generated strings stay in memory only; your options are remembered in this browser, the strings are not.
Frequently asked questions
- Is this random string generator cryptographically secure?
- Yes. Every character comes from crypto.getRandomValues, the browser's cryptographically secure random source, and the index is chosen with rejection sampling so there is no modulo bias. Math.random is never used, and the strings are generated locally without any network request.
- How many bits of entropy does a token need?
- 128 bits or more is a common target for API keys, session tokens and password reset tokens. 22 Base64URL characters (about 132 bits), 32 hex characters (128 bits) or 22 alphanumeric characters (about 131 bits) meet it. The tool shows the exact bits for your alphabet and length; a fixed prefix such as sk_ adds none.
- What is the difference from Password Generator?
- Password Generator guarantees that each selected character class appears, which suits login policies. Token mode here samples every position uniformly from the alphabet, which is what API keys and identifiers need, and offers hex, Base64URL-safe, URL-safe and custom Unicode alphabets, prefixes and bulk export. Both use the same unbiased random engine.
