Random String Generator
Generate random strings, tokens and API keys online in hex, Base64URL or a custom alphabet, using your browser's cryptographically secure generator.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the Random String Generator
The Random String Generator creates tokens, API keys, salts and IDs from the browser's cryptographically secure random source, in hex, Base64URL or any alphabet you define.
Everything is generated in your browser; nothing you enter is uploaded, and anything random comes from a cryptographically secure source.
How to use the Random String Generator
- Choose the length and the alphabet (hex, Base64URL, alphanumeric or custom).
- Set how many strings to generate.
- Copy the results.
Common mistakes
- Too short for a secret. Tokens and API keys need at least 128 bits of randomness: 32 hexadecimal or 22 Base64URL characters. Six-digit codes are only suitable when attempts are rate-limited.
- Characters that break URLs or shells. A custom alphabet with +, /, & or quotes can break URLs, environment files and shell commands. Base64URL and alphanumeric strings are safe everywhere.
- Using the prefix as part of the secret. A prefix such as sk_live_ labels the key type for people and secret scanners; it adds no randomness. Count only the random part when choosing the length.
Works well with the Random String Generator
- Password Generator: generate passwords with a strength meter.
- UUID Generator: generate standard UUIDs for identifiers.
- Hash Generator: hash a token before storing it.
Frequently asked questions
How long should an API key be?
At least 128 bits of randomness: 32 hex characters or 22 Base64URL characters.
Is Math.random() used?
No. Values come from crypto.getRandomValues, which is suitable for security purposes.
Should I store API keys in plain text?
Store a SHA-256 hash of the key and compare hashes on each request, like a password. Show the full key to the user only once.
Are the strings unique?
They are random, not checked for duplicates. With 128 bits or more, a collision is so unlikely that it can be ignored.
Guides and tutorials
- Security & Encoding
MD5 vs SHA-1 vs SHA-256: Choosing the Right Hash Function
What hash functions do, why MD5 and SHA-1 are broken for security, when SHA-256 is right, why passwords need bcrypt or Argon2, and how HMAC signs messages.
· 6 min read
- Security & Encoding
How Strong Is Your Password? Entropy Explained with Examples
Calculate password strength in bits of entropy, see how long real passwords take to crack, compare passphrases with random strings, and generate them safely.
· 5 min read
- Security & Encoding
UUID v4 vs v7: Which UUID Should You Use as a Database Key?
How UUID v4 and v7 are built, why random v4 keys slow down database indexes, what v7's timestamp reveals, and how to choose between UUIDs and integer IDs.
· 6 min read
Related tools
Invoice Generator
Create professional invoices free: GST (CGST, SGST, IGST), VAT, 40+ currencies, logo, signature and UPI QR code. Download a PDF, no sign-up, nothing uploaded.
Email Signature Generator
Create a professional email signature from ready-made templates, or paste your own HTML. Copy it into Gmail, Outlook or Apple Mail, or download the HTML.
Password Generator
Generate strong, random passwords online with your browser's cryptographically secure generator. Choose length and character sets; check the strength meter.
UUID Generator
Generate UUID v4 and time-ordered UUID v7 identifiers (GUIDs) in bulk, with uppercase, hyphen and brace options, using a cryptographically secure generator.
Large CSV Generator
Generate realistic fake test data (names, emails, phones, companies, addresses, IDs and dates) and download it as CSV or Excel (.xlsx). Free, in your browser.
QR Code Generator
Create free QR codes online for websites and text, with custom size, colours and error correction. Live preview, and download as PNG or SVG.