Random String Generator
Generate secure random strings for passwords, API keys, coupon codes, test data and IDs. Set the length from 1 to 1,024 characters, make up to 1,000 strings at once, use letters and numbers, hexadecimal, URL-safe characters or your own, and leave out look-alike characters. Each string is made with your browser’s cryptographic random generator and never leaves your device.
- Cryptographically secure
- Up to 1,024 characters
- Made on your device
- Strings
- 0
- Characters to pick from
- 0
- Randomness per string
- 0
- Characters in total
- 0
How to generate a random string
Ten random strings of 16 letters and numbers are ready when the page opens. To change them:
-
Set the length and count
Any length from 1 to 1,024 characters, and up to 1,000 strings. The chips set common lengths in one tap.
-
Choose the characters
Pick a set under Characters, or My own characters to type exactly which characters to use. Tick Leave out look-alikes for codes people will read or type.
-
Copy or download
Each string has its own Copy button. Copy all copies the whole list one per line, comma-separated or space-separated, and Download .txt saves it.
A 32-character hexadecimal string, like the ones used for API keys and tokens, has 128 bits of randomness: there are 2¹²⁸ possible strings.
Character sets
What each **Characters** setting uses, and how random a 16-character string from it is:
| Characters | Uses | How many | Without look-alikes | 16 characters |
|---|---|---|---|---|
| Letters and numbers | A–Z, a–z, 0–9 | 62 | 56 | 95 bits |
| Letters only | A–Z, a–z | 52 | 48 | 91 bits |
| Lowercase or uppercase letters | a–z or A–Z | 26 | 24 | 75 bits |
| Numbers only | 0–9 | 10 | 8 | 53 bits |
| Hexadecimal | 0–9 and a–f (or A–F) | 16 | 14 | 64 bits |
| URL-safe | A–Z, a–z, 0–9, - and _ | 64 | 58 | 96 bits |
| Letters, numbers and symbols | The above plus ! # $ % & ( ) * + - . / : ; < = > ? @ [ ] ^ _ { } ~ | 88 | 82 | 103 bits |
The symbols leave out quotes, the backslash, the backtick and the comma, which often need escaping in code, CSV files and command lines.
How strong is a random string?
The randomness of a string, in bits, is its length × log₂(number of characters it’s picked from). Each extra bit doubles the number of guesses an attacker needs.
| Length | Letters and numbers (62) | Hexadecimal (16) | With symbols (88) |
|---|---|---|---|
| 8 | 47 bits | 32 bits | 51 bits |
| 12 | 71 bits | 48 bits | 77 bits |
| 16 | 95 bits | 64 bits | 103 bits |
| 24 | 142 bits | 96 bits | 155 bits |
| 32 | 190 bits | 128 bits | 206 bits |
| 64 | 381 bits | 256 bits | 413 bits |
These numbers hold only for strings made at random, like the ones here. A password a person makes up has far less randomness than its length suggests.
Random strings for passwords, API keys and codes
- Passwords. Use 16 or more characters from Letters, numbers and symbols, and keep them in a password manager. If a site rejects some symbols, switch to Letters and numbers and add a few characters.
- API keys, tokens and secrets. Hexadecimal or URL-safe strings work in headers and web addresses without escaping. Python’s documentation says that, as of 2015, 32 bytes (256 bits) of randomness were believed to be enough for typical tokens: that’s a 64-character hexadecimal string.
- Coupon, invite and voucher codes. Use Uppercase letters or My own characters, tick Leave out look-alikes so nobody confuses 0 and O, and keep Every string different on.
- Test data and IDs. Make up to 1,000 strings at once and download them as a .txt file, one per line.
Is this random string generator secure?
Each character is picked with crypto.getRandomValues, the browser’s cryptographically strong random number generator, not Math.random, which MDN describes as a non-cryptographic source. Characters are picked with rejection sampling, so every character in the set is exactly as likely as every other one.
The strings are made on your device. They aren’t sent to a server or saved, and a new set replaces the old one when you press Generate strings or change an option. Once you copy a password, treat it like any other secret: don’t paste it into chats or documents other people can see.
Generate a random string in JavaScript or Python
To make random strings in your own code, use the cryptographic random source, not the general-purpose one:
- JavaScript (browser or Node.js): fill an array with
crypto.getRandomValues(new Uint32Array(length))and map each number to a character, drawing again when a number falls in the uneven top of the range. - Python:
secrets.token_hex(16)returns 32 hexadecimal characters,secrets.token_urlsafe(16)a URL-safe string, and''.join(secrets.choice(chars) for _ in range(n))picks from your own characters. Python’s documentation says to usesecretsrather thanrandomfor anything secret.
Random string generator FAQ
How long should a random string be?
For a password, 16 or more characters from letters, numbers and symbols (103 bits). For an API key or token, 32 to 64 hexadecimal characters (128 to 256 bits). Short codes people type, like invite codes, can be 6 to 10 characters if every code is checked by your system.
What is a random alphanumeric string?
A string of letters and numbers only: A–Z, a–z and 0–9, 62 characters in all. Choose Letters and numbers, the default, for a random alphanumeric string generator.
How do I make a random hex string?
Choose Hexadecimal (0–9, a–f) or (0–9, A–F) under Characters and set the length. That makes it a random hex string generator; 32 characters give 128 bits.
Can I leave out similar-looking characters?
Yes. Tick Leave out look-alikes to drop 0, O, o, 1, l, I and |.
Are the strings unique?
With Every string different on, no string in a list repeats. If your settings allow fewer different strings than you asked for, like 2-digit numbers (100), the tool makes all of them and tells you.
Can I use my own characters?
Yes. Choose My own characters and type them. Each character you type counts once, however often you type it, and spaces are ignored.
How many strings can I generate?
Up to 1,000 strings of up to 1,024 characters each, 1,024,000 characters in one press. The first 300 are shown; Copy all and Download include every one.
Can I use it as a random code generator for coupons?
Yes. Use uppercase letters or your own characters, leave out look-alikes and keep Every string different on. Make sure your system checks each code, since anyone could guess a short one eventually.
Is anything sent or saved?
No. The strings are made in your browser and nothing is sent or stored.
Sources and references
- Crypto: getRandomValues() method, MDN Web Docs
- secrets: Generate secure random numbers for managing secrets, Python documentation
- What is password entropy?, TechTarget
More text generators tools
- A? Random Letter Generator Pick a random letter A–Z, vowels or consonants, or a whole shuffled alphabet. Open tool
- abc Random Word Generator Random nouns, verbs, adjectives and adverbs, by length and first letter. Open tool
- Distinct Unique Character Counter List every distinct character with its Unicode code point, and check for pangrams. Open tool
- ×10,000 Text Repeater Repeat text, words or emoji up to 10,000 times, on new lines or with any separator. Open tool