Skip to main content

Random String Generator

Build random character strings for tokens, fixtures, and test IDs. This is not the password page. Symbols default to off.

Rated 4.7 out of 5 based on 378 reviews

How to generate a random string

  1. Set length from 1 to 256 and how many strings to print.
  2. Leave lowercase, uppercase, and numbers on for a typical alphanumeric token. Keep Symbols off unless the consumer allows punctuation.
  3. Generate. Each line is an independent string from the sets you left on.
  4. Copy what you need into a fixture or config. For a login secret, open the password generator instead.

Random alphanumeric token

Unbiased string from selected character sets

Default alphabeta-z, A-Z, and 0-9. Symbols off
Length1 to 256 characters
SamplingWeb Crypto rejection sampling per character
Not a password UINo similar-character exclusions or require-each-set rules
Related secretsPassword and passphrase pages for login secrets
Related IDsNanoID when you want a URL-friendly public ID

Alphanumeric tokens, not login passwords

Use this page for dummy tokens, coupon codes, and test headers. It is not framed as an account password. The password generator adds exclusion options and can require every selected set. The passphrase generator prints memorable words. If you need a public URL id, prefer NanoID with a known alphabet.

Symbols stay off by default

Many APIs reject punctuation in tokens. Symbols stay unchecked until you turn them on. Lowercase, uppercase, and digits start on so a 16-character string is already a mixed alphanumeric value. Turn a set off if the consumer is case-sensitive in only one direction or forbids digits. At least one set must stay on.

How each character is chosen

The engine joins the sets you selected, then draws each character with rejection sampling so every remaining symbol is equally likely. Math.random is not used. Unlike the password page, this mode does not force one character from each set and does not shuffle a required prefix. Length is simply length.

Length, count, and local use

Length goes to 256. Count goes to 1000 lines. Generation stays in this tab. CZNull does not store the strings. Treat a long random string as sensitive if you later paste it into a real system. For short numeric PINs, use the PIN page under passwords, not this alphabet tool.

Collisions and uniqueness

This generator does not check that two lines differ. Independent samples can collide, especially at short lengths. If you need uniqueness in a database, enforce it there, or use a longer string, or switch to NanoID or UUID for identifier practice.

Random string questions

Should I use this as a website password?
Prefer the password generator for login secrets. This page is for tokens and test strings, and it leaves symbols off by default.
Why are symbols off?
Punctuation often breaks URLs, filenames, and naive parsers. Turn Symbols on only when the consumer allows that set.
Is sampling unbiased?
Yes. Each character is drawn with Web Crypto rejection sampling from the joined alphabet you selected.
What if every checkbox is off?
Generation fails. Leave at least one character set on.
How is this different from NanoID?
NanoID is an identifier with a URL-friendly default alphabet and a typical length of 21. This page is a generic character string with checkboxes.
Are the strings uploaded?
No. They exist in this tab until you copy or refresh.