Random String Generator
About this tool
About Random String Generator
Generate random strings for test data, invite and coupon codes, file names, database IDs, API tokens or nonces. Pick an alphabet from the presets (letters and digits, lowercase and digits, letters only, upper or lower case, digits, hex, URL-safe, Base58 without look-alike characters, RFC 4648 Base32, Crockford Base32 or all printable ASCII) or type your own characters, including accented letters and emoji. Set any length up to 4,096 characters, an optional prefix such as inv_ or sk_test_, and how many strings you need, then copy one, copy all or download the list. Every character is drawn with your browser's cryptographically secure random generator using rejection sampling, so no character is more likely than another, and duplicates in a custom alphabet are removed for the same reason. The panel shows the exact entropy of each string so you can tell whether it is long enough to be unguessable. Nothing is uploaded or stored.
Built and maintained by Abhi JainUpdated
How to Generate Random Strings
- 1
Choose the characters
Pick a preset under Characters, or choose Custom and type the characters you want.
- 2
Set the length and count
Use the Length slider or type an Exact length, add an optional Prefix, and choose How many.
- 3
Copy or download
Copy a single string, Copy all, or Download the list as a text file.
Random String Generator: questions and answers
Are these strings secure enough for tokens and passwords?
Yes, if they are long enough. They come from crypto.getRandomValues, the browser's cryptographic random generator, with unbiased sampling. For a secret token aim for at least 128 bits of entropy, for example 22 URL-safe characters or 32 hex characters.
How is the entropy calculated?
Entropy = length × log2(alphabet size). A 32-character string from 62 letters and digits has 32 × 5.95 ≈ 190 bits. The prefix is fixed, so it adds nothing.
What is Base58 and when should I use it?
Base58 is letters and digits without 0, O, I and l, which are easy to confuse. It is used in Bitcoin addresses and is handy for codes people read aloud or type.
Can two generated strings be the same?
It is possible but, for long strings, vanishingly unlikely. With 128 bits of entropy you would need about 2^64 strings before a repeat becomes likely. For short codes, check for duplicates in your database.
Why are duplicate characters in my custom set removed?
If a character appeared twice it would be twice as likely to be picked. Removing duplicates keeps every character equally likely and the entropy figure correct.
Related Tools
- Secret Key GeneratorCryptographically secure 128–1024-bit keys in hex, Base64 or Base64url.
- Password GeneratorStrong random passwords with a live strength and entropy estimate.
- Passphrase GeneratorRandom, memorable passphrases from the EFF wordlist with exact entropy.
- Random Name PickerSpin a wheel or draw winners from a list of names, with remove-winner mode and history.