Random String Generator
Choose how long each string should be, how many you want and which characters may appear: uppercase, lowercase, digits, symbols, or any characters of your own. Presets give hex, a PIN, URL-safe text and more. You can leave out look-alike characters such as 0 and O, and ask for no repeated character in a string. The strings come from your browser's secure random number generator, and the page shows the size of the set and the bits of randomness in each string. Everything runs in your browser.
1 to 4,096
1 to 1,000
62 characters in the set, about 95.3 bits per string
Each character comes from your browser's secure random number generator, and a number that would favor some characters over others is thrown away and drawn again, so every character in the set is equally likely. The strings are made in this page and never sent anywhere. The symbols are ! @ # $ % ^ & * ( ) - _ = + [ ] { } ; : , . ? and the look-alike list is 0 O o 1 l I |.
Related Tools
[6 suggestions]Password Generator
Generate cryptographically secure random passwords with custom length and character sets.
Developer & WebUUID Generator
Generate cryptographically random UUID v4 identifiers instantly, one or in bulk.
Developer & WebRandom Number Generator
Pick random numbers between any minimum and maximum, with decimals, no repeats and sorting. Every value is equally likely.
Writing & ContentULID Generator and Decoder
Generate sortable ULIDs, or paste one to read the time it was created and see its 128 bits as hex and as a UUID.
Developer & WebHash Generator (MD5, SHA-1, SHA-256, SHA-512)
Generate MD5, SHA-1, SHA-256, and SHA-512 cryptographic hashes live from any text using the native Web Crypto API.
Developer & WebHMAC Generator (SHA-1, SHA-256, SHA-384, SHA-512)
Create an HMAC signature for a message and secret key with SHA-1, SHA-256, SHA-384 or SHA-512, as hex or Base64, and check a signature you were given.
Developer & WebAbout the Random String Generator
Each character is picked with the secure random number generator built into your browser, and the choice is unbiased. A common shortcut, taking a random byte modulo the size of the set, favors the first characters whenever the set size does not divide 256 evenly: with 200 characters the first 56 would come up twice as often as the rest. This tool avoids that by rejection sampling: a random number that falls in the uneven leftover at the top of the range is thrown away and drawn again, so every character in the set is exactly as likely as every other. For sets larger than 256 characters two random bytes are used the same way. The randomness in a string, its entropy, is its length times the base 2 logarithm of the set size, so 16 letters and digits (62 characters) give about 95.3 bits, and 6 digits give about 19.9 bits. With no repeated characters, a string is a selection without replacement, made with a partial shuffle, and the entropy is slightly lower. The set can include any characters you type, including emoji, each counted as one character, and a leave-out list and a look-alike filter (0, O, o, 1, l, I and |) remove characters again. You can make up to 1,000 strings of up to 4,096 characters in one go, with a total cap of 200,000 characters. These strings suit identifiers, test data, tokens and codes. Everything runs in your browser and nothing is sent or stored.
How do I generate a random string?▾
Set the length and the number of strings, tick the kinds of characters you want or type your own, and press Generate. Copy the result with the button. Each string is made from your browser's secure random number generator.
Is the random string generator secure?▾
It uses the secure random number generator of your browser, the one meant for security work, and picks characters without bias. The strings are made on your device and not sent anywhere. For passwords, a longer string from a large set gives more bits of randomness.
What is modulo bias?▾
If you take a random byte from 0 to 255 and use it modulo the number of characters, the first characters are picked slightly more often unless the number divides 256. This tool throws away the numbers from the uneven leftover and draws again, so every character is equally likely.
How many bits of randomness does a string have?▾
Its length times log base 2 of the number of characters. 16 characters from 62 letters and digits give about 95.3 bits, 8 give about 47.6 bits, and 6 digits give about 19.9 bits. With no repeats, the figure is a little lower.
Can I use my own characters?▾
Yes. Type them into the extra characters box, including emoji, and untick the other sets if you want only those. Repeated characters in the box are counted once, and the leave-out box removes characters again.
Are my strings stored or sent anywhere?▾
No. They are made in your browser and are gone when you close the page.