Random String Generator

Generate random strings in hex, Base64, alphanumeric or custom alphabets for tokens, test fixtures and identifiers.

190.5Bits of entropy
62Alphabet size

Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.

What the Random String Generator does

Use this random string generator to generate random strings in hex, Base64, alphanumeric or custom alphabets for tokens, test fixtures and identifiers. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for generating an API key or session token for a project. There are more free online tools on FreeToolStation.org.

How to use it

  1. Pick a character set, or type your own alphabet in the box.
  2. Set the length and how many strings you want.
  3. Add a prefix if your system uses one.
  4. Copy or download the result.

How it works

Characters are drawn from crypto.getRandomValues() using rejection sampling. Bytes that fall in the biased tail — the values above the largest multiple of the alphabet size — are discarded and redrawn rather than folded in with a modulo. Modulo would make the first few characters of the alphabet slightly more likely, which quietly reduces real entropy.

The "no look-alike" set removes 0, O, 1, l and I, which matters whenever a string will be read aloud, typed from a screen or printed on something. The entropy cost is small and the support-call saving is not.

Hexadecimal is the right choice for anything that must survive case-insensitive handling. Base64url is the most compact option that is safe in URLs and filenames.

When to use it

  • Generating an API key or session token for a project.
  • Creating test fixtures that need unique values.
  • Producing voucher or invite codes that people will type.

Common mistakes to avoid

  • Generating production secrets in a browser rather than on the server that will use them.
  • Using an alphabet with look-alike characters for codes people must read and type.
  • Choosing a short length for a token that protects something valuable.

Frequently asked questions

Is this secure enough for an API key?

The randomness is cryptographically secure, so a 32-character string from a 62-character alphabet carries around 190 bits — far beyond guessable. For production secrets, generating on the server that will store them avoids the key ever existing on a client device at all.

Why avoid look-alike characters?

Because 0 and O, and 1, l and I, are indistinguishable in many fonts. For any code a human reads and types, removing them costs a little entropy and prevents a lot of failed entries.

Related tools

See all security & privacy tools →