Random string generator
Generate random strings of any length, from the characters you choose. Every character is equally likely, and the page shows how many bits of randomness each string has.
runs in your browser · nothing uploaded
How to use it
- Set the length and how many strings you want.
- Tick the character sets to use, or tick custom and type your own characters.
- Press Generate for a new batch. Copy all or download them as a text file.
Choosing the characters
Letters and digits (62 characters) are safe almost everywhere: in URLs, file names, JSON and shell commands. Symbols add strength per character but often need escaping. If people will read the strings aloud or type them, use custom characters that leave out look-alikes such as 0 and O, or 1 and l.
Each character from a set of 62 adds about 5.95 bits. A 22-character alphanumeric string has about 130 bits, which is enough for a secret token.
Fair randomness
A common bug is taking a random byte modulo the number of characters. With 62 characters that makes the first eight characters slightly more likely than the rest. This page uses rejection sampling instead: it throws away the few values that would bias the result and draws again.
Questions
Is it random enough for passwords and tokens?
Yes. Every character comes from crypto.getRandomValues, the browser's cryptographically secure random generator. Nothing is sent to a server.
Can I generate a random Base64 or hex string?
Yes: use custom characters 0123456789abcdef for hex. For a Base64 secret of a given number of bytes, the API key generator has Base64url output.
Why does the same character sometimes appear twice in a row?
Because each character is chosen independently, as true randomness requires. Forbidding repeats would make the strings easier to guess, not harder.