Random string generator
Make secure random strings, API keys and codes with your own length, characters and prefix. Free, no sign-up, and everything runs in your browser.
Presets
Characters per string, up to 1024
Strings to make, up to 1000
Added before each string, like sk_live_
Characters to use
Added to the sets above. Repeated characters count once.
Random strings
Making strings...
What this random string generator does
This tool makes random strings of any length from the characters you choose. Use it for API keys, secret tokens, invite codes, test IDs, temporary passwords or any value that must be hard to guess.
Every character comes from your browser's cryptographically secure random generator, crypto.getRandomValues(), which MDN describes as suitable for cryptographic purposes.1 The tool does not use Math.random(), which is fine for games and animations but must not be used for anything related to security.2 Each character in your set is exactly as likely as the others: values that would make some characters more common are thrown away and drawn again. The strings are made in your browser tab and are never sent anywhere.
How to make a random string
- Pick a preset or choose the character sets yourself: lowercase, uppercase, digits and symbols. Add any extra characters, including accented letters or emoji, in Your own characters.
- Set the Length of each string and How many you need, up to 1,000 at a time.
- Add a Prefix if your keys need one, for example
sk_test_for a secret test key orinv_for invite codes. The prefix is not random, so it adds no strength. - Select Copy all or Download for a .txt file with one string per line. Generate again gives you a new set with the same settings.
Turn on Leave out look-alike characters when people must read or type the code, such as a coupon or an invite code you send to beta testers. It removes characters like 0 and O, or 1, l and I.
How strong is a random string?
The badge shows the entropy of each string in bits: the length times the base-2 logarithm of the number of characters in your set. Each extra bit doubles the number of possible strings. OWASP asks for at least 64 bits of entropy in a session ID, made by a secure generator, so that it can't be guessed by brute force.3 For API keys and other long-lived secrets, aim higher: the tool marks 128 bits or more as strong. A 22-character alphanumeric string already passes 128 bits, and 32 characters gives about 190.
OWASP also lists the secure generator to use in each language, so you can make the same kind of value in your own code: crypto.randomBytes() or crypto.randomInt() in Node.js, secrets in Python and SecureRandom in Ruby, for example.4 Use this page for one-off values, and generate secrets in code when your app must create them for each user.
If you add waitlist referral codes or private beta invites before a product launch, a short code from a set without look-alikes is easy to share and still hard to guess.
More free tools
Test credit card numbers generator
Test credit card numbers for form and checkout tests, made in your browser. Generate valid-format numbers for 7 card networks and check any number.
ASCII table and converter
ASCII table with all 128 codes in decimal, hex, octal and binary, plus a converter from text to ASCII codes and back. Runs in your browser.
Keycode finder
Keycode finder that runs in your browser. Press any key to see its JavaScript keyCode, key, code and location, and copy a ready keydown handler.
Image converter
Image converter that runs in your browser. Convert PNG, JPG, WebP, AVIF, GIF and SVG files in bulk, with quality and resize options. No uploads.
HTML to Markdown converter
HTML to Markdown converter that runs in your browser. Paste HTML or rich text from a web page, Google Docs or Word and get clean GitHub Markdown.
PX to REM converter
PX to REM converter that runs in your browser. Convert px to rem and rem to px at any root font size, or convert a whole stylesheet at once.
Frequently asked questions
Sources
MDN Web Docs: Crypto: getRandomValues() method
MDN Web Docs: Math.random()
OWASP Cheat Sheet Series: Session Management Cheat Sheet (session ID entropy)
OWASP Cheat Sheet Series: Cryptographic Storage Cheat Sheet (secure random number generation)
IETF: RFC 4648, The Base16, Base32, and Base64 Data Encodings (URL and filename safe alphabet)