Random String Generator
HG-19Choose a length and a character set, then press Generate for random strings. The characters are picked in your browser with crypto.getRandomValues.
Runs in your browser. Nothing is uploaded.
Optional: your own characters to draw from. Leave empty to use the sets below.
Random strings
How to use it
- Pick a length and how many strings you want.
- Tick the sets to use: a-z, A-Z, 0-9 and symbols. Or type your own characters in the box to use only those.
- Press Generate. A new set of strings appears each time.
- Copy the result or download it as a .txt file.
How the characters are picked
Each character comes from crypto.getRandomValues, the browser's secure random source, and not from Math.random. To avoid favoring some characters, the code throws away random values that fall in the uneven tail of the range before taking a remainder, which is called rejection sampling. Every character in the pool is equally likely, and each position is drawn independently of the others.
Your own character pool
Type characters into the box and only those are used. Each distinct character counts once, so aaab is a pool of a and b, line breaks are ignored, and emoji count as single characters. This makes it simple to get hex strings (0123456789abcdef), a Base32 alphabet, or a ticket code without look-alike letters. With the box empty, the ticked sets are used, and at least one must be ticked.
What it does not do
A string can come out without a digit or a capital letter, because the sets are not forced to appear. That is the difference from the password generator, which forces each ticked set. These strings are not checked against any site's rules. Nothing is stored or sent: they exist only on this page until you close it, so copy the one you want.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Select at least one character set (a-z, A-Z, 0-9, symbols) or type your own characters in the box. | No set is ticked and the box is empty, so there is no pool to draw from. | Tick at least one set, or type characters into the box. |
The custom characters contain a broken emoji or surrogate half. Remove it and try again. | The box holds half of a two-part character, which cannot be output on its own. | Delete the broken character or paste the full emoji. |
Questions people ask
How do I generate a random string online?
Choose a length, tick the character sets you want, and press Generate. The strings appear in the output box, one per line. Copy them or download a .txt file. Everything runs in your browser.
Is this random string generator secure?
The characters come from crypto.getRandomValues with rejection sampling, which is the browser's cryptographically secure source. The strings are never stored or sent. For a password with every set guaranteed, use the password generator page instead.
Can I make a random hex string?
Yes. Type 0123456789abcdef into the box and press Generate. Only those 16 characters are used, so a length of 32 gives a 128-bit random value written in hex.
How many random strings can I generate at once?
Up to 100 at once, with lengths from 1 up to 1024 characters. Pick how many in the How many select. Each string is drawn independently, so duplicates are possible, especially for short lengths.
Why does my string have no digits or capitals?
Because the sets are only the pool the characters come from; they are not each required. A 16 character string from 62 characters has a real chance of missing a set. Raise the length, or use the password generator to force each set.
What symbols are included?
The symbols set is !@#$%^&*()-_=+[]{}:;,.?/~. Tick it to add them to the pool. If you need a different set, type your own characters into the box and only those will be used.
About this tool
Each character is picked with crypto.getRandomValues, using rejection sampling so no character is more likely than another. Strings are made in your browser and are never stored or sent anywhere; they disappear when you close the page, so copy the one you want. Unlike the password generator, it does not force every ticked set to appear in each string, so a short string may contain no digit. If you type characters into the box, only those are used (each distinct character counts once, line breaks are ignored) and the ticked sets are ignored. The symbols are !@#$%^&*()-_=+[]{}:;,.?/~. It does not check a string against any site's own rules.