Random string generator

Secure random strings from any alphabet: Base62, hex, Base32 or characters you choose. One or hundreds at a time, generated in your browser.

Alphabet of 62 characters · 143 bits per string

Picking an alphabet

AlphabetBits / charChars for 128 bitsGood for
Hex432Keys, hashes, anything that expects hex
Crockford Base32526Codes people read aloud or type (no I, L, O, U)
Base625.9522URL-safe tokens and IDs
Letters, digits, symbols6.5520Passwords

Most languages’ default Math.random() or rand() is not safe for secrets: its output can be predicted from a few samples. This page uses the browser’s CSPRNG, the same source recommended by the W3C Web Crypto specification for key material.

Need something shaped like an API key or JWT secret? The API key generator formats keys with prefixes and encodings. Need unique IDs? Use the UUID generator.

Questions people ask

Is this random string generator cryptographically secure?

Yes. Every character is chosen with crypto.getRandomValues and rejection sampling, so each character in your alphabet is equally likely. That makes the output suitable for tokens, salts, invite codes and test data.

Can I use my own characters?

Yes. Choose “Custom” and type any set of characters. Duplicates are removed automatically, so typing “aab” gives a two-character alphabet.

How long should a random string be?

For something that must not be guessed, such as a session token or reset link, aim for at least 128 bits: 22 Base62 characters, or 32 hex characters. The entropy readout updates as you change length and alphabet.

What is Base62?

Base62 uses digits, uppercase and lowercase letters: 62 characters, about 5.95 bits each. It is URL-safe without escaping and avoids the + and / characters of Base64.