Random String Generator — Free Online Tool

Generate cryptographically secure random strings for passwords, API keys, tokens. Custom length, character sets (letters, numbers, symbols). Bulk generation, export.

Use this free online Random String Generator directly in your browser. No signup required, no data leaves your device. Part of Utilier — a collection of 133+ developer utilities.

What is Random String Generator (Password, Token, Key)?

Random string generator creates cryptographically secure random strings for passwords, API keys, tokens, session IDs, or test data. Customize length (8-128+ characters) and character sets: uppercase letters (A-Z), lowercase (a-z), numbers (0-9), symbols (!@#$%^&*). Uses Web Crypto API (window.crypto.getRandomValues) for secure randomness (unpredictable, not guessable). Generate single strings or bulk (100s at once). Options include: exclude ambiguous characters (0/O, 1/I/l), custom character set, minimum requirements (at least 1 uppercase, 1 number, 1 symbol). Export as CSV, JSON, or plain text for use in code, databases, or spreadsheets.

  • Custom length: Set string length: 8-128+ characters. Example: 8 for weak password, 16 for strong, 32 for API key, 64 for token. Longer = more secure.
  • Character sets: Choose combinations: uppercase (A-Z), lowercase (a-z), numbers (0-9), symbols (!@#$%^&*()_+-=[]{}). Or use custom character set (hex: 0-9a-f, base64: A-Za-z0-9+/).
  • Exclude ambiguous: Option to exclude confusing characters: 0/O (zero/oh), 1/I/l (one/I/L), 5/S, 8/B. Improves readability for manual entry (passwords, license keys).
  • Minimum requirements: Enforce at least 1 uppercase, 1 lowercase, 1 number, 1 symbol (password policies). Regenerates until requirements met.
  • Bulk generation: Generate 1 to 1000+ strings at once. Useful for API keys, test data, or password lists. Export as CSV or JSON.

Why use random string?

Creating secure random strings manually is error-prone (weak passwords, predictable patterns). This tool generates cryptographically secure random strings instantly.

  • Secure passwords: Generate strong passwords (16+ chars, letters, numbers, symbols). Cryptographically secure (not guessable). Avoid weak passwords (password123, qwerty).
  • API keys and tokens: Create API keys (32-64 chars, hex or base64), session tokens, CSRF tokens, password reset tokens. Unpredictable = secure against brute force.
  • Avoid predictable patterns: Humans are bad at randomness (password1, abc123). Tool uses crypto randomness (truly random, not predictable).
  • Comply with password policies: Many sites require: 8+ chars, 1 uppercase, 1 lowercase, 1 number, 1 symbol. Tool enforces these rules automatically.
  • Bulk test data: Generate 100s of random strings for testing (user IDs, session IDs, test passwords). Export as CSV for databases or spreadsheets.
  • Custom character sets: Use hex (0-9a-f) for color codes, base64 (A-Za-z0-9+/) for encoding, or custom alphabet (consonants only, no vowels to avoid profanity).

When to use random string

Use whenever you need random strings for passwords, keys, tokens, or IDs.

  • Generating strong passwords (16+ chars, letters, numbers, symbols) for accounts or services.
  • Creating API keys (32-64 chars, hex or alphanumeric) for authentication.
  • Generating session IDs, CSRF tokens, or password reset tokens (unpredictable, secure).
  • Creating license keys or product keys (exclude ambiguous chars for readability).
  • Generating test data (random usernames, IDs, strings) for databases or testing.
  • Creating secrets for encryption keys, salts, or nonces (cryptographically secure).
  • Bulk generation of passwords or tokens (100+ at once) for user onboarding or testing.

How to use random string

Select options (length, character sets), click Generate.

  1. Set string length: Enter length: 8-128+ characters. Example: 8 = weak, 16 = strong, 32 = API key, 64 = token. Longer = more secure.
  2. Choose character sets: Select: Uppercase (A-Z), Lowercase (a-z), Numbers (0-9), Symbols (!@#$%^&*). Or use presets: Alphanumeric (A-Za-z0-9), Hex (0-9a-f), Base64 (A-Za-z0-9+/=).
  3. Exclude ambiguous (optional): Exclude confusing characters: 0/O, 1/I/l, 5/S, 8/B. Improves readability for manual entry (license keys, passwords).
  4. Set minimum requirements (optional): Enforce: at least 1 uppercase, 1 lowercase, 1 number, 1 symbol. Tool regenerates until requirements met (password policies).
  5. Set quantity (optional): Generate 1 string (default) or bulk (10, 100, 1000). Useful for API keys, test data, or password lists.
  6. Click Generate: Tool generates random strings using Web Crypto API. Results appear instantly (even for 1000 strings).
  7. Copy or export: Copy to clipboard, download as CSV (for Excel), JSON (for code), or plain text (one per line). Use in spreadsheets, databases, or code.

Key features

  • Custom length: 8 to 128+ characters. Longer = more secure. 16+ recommended for passwords, 32+ for API keys.
  • Character sets: Uppercase, lowercase, numbers, symbols. Or presets: Alphanumeric, Hex, Base64. Or custom character set.
  • Exclude ambiguous: Remove 0/O, 1/I/l, 5/S, 8/B for readability. Useful for license keys or manual entry.
  • Password policies: Enforce minimum requirements: 1 uppercase, 1 lowercase, 1 number, 1 symbol. Meets common password rules.
  • Bulk generation: Generate 1 to 1000+ strings at once. Fast and efficient.
  • Cryptographically secure: Uses Web Crypto API (window.crypto.getRandomValues). Not predictable like Math.random().
  • Export formats: CSV, JSON, plain text. Copy or download. Use in Excel, databases, code.

Common use cases

  • Strong password (16 chars): Length: 16, Character sets: Uppercase, Lowercase, Numbers, Symbols, Minimum: 1 of each. Example: aB3$kL9mP2qR5tY8. Secure against brute force.
  • API key (32 chars, hex): Length: 32, Character set: Hex (0-9a-f). Example: 4f3a2b1c8e7d6a5b9c0d1e2f3a4b5c6d. Used for API authentication.
  • Session token (64 chars, base64): Length: 64, Character set: Base64 (A-Za-z0-9+/). Example: aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789+/aBcDeFgHiJkLmNoPqRsTuVwXyZ012. Used for session management.
  • License key (20 chars, no ambiguous): Length: 20, Character sets: Uppercase, Numbers, Exclude ambiguous: Yes. Example: A3K9P2R5T7W4X6Y8. Easy to read and type (no 0/O, 1/I).
  • CSRF token (32 chars): Length: 32, Character sets: Uppercase, Lowercase, Numbers. Example: aB3kL9mP2qR5tY8uV7xW4zA1bC6dE2fG. Used to prevent CSRF attacks.
  • Bulk passwords (100, 12 chars each): Quantity: 100, Length: 12, Character sets: All. Generates 100 passwords. Export as CSV for user onboarding or password manager.

Examples

Random string generation examples.

Strong password (16 chars)

Length: 16, Character sets: Uppercase, Lowercase, Numbers, Symbols
aB3$kL9mP2qR5tY8

16 characters with mixed case, numbers, symbols. Entropy: ~105 bits (very strong). Secure against brute force.

API key (32 chars, hex)

Length: 32, Character set: Hex (0-9a-f)
4f3a2b1c8e7d6a5b9c0d1e2f3a4b5c6d

Hexadecimal (0-9a-f). Used for API authentication, tokens, or database IDs. Entropy: 128 bits (cryptographically secure).

License key (20 chars, no ambiguous)

Length: 20, Character sets: Uppercase, Numbers, Exclude ambiguous: Yes
A3K9P2R5T7W4X6Y8Z2

No 0/O, 1/I/l, 5/S, 8/B. Easy to read and type manually. Used for software licenses or product keys.

Session token (64 chars, base64)

Length: 64, Character set: Base64 (A-Za-z0-9+/)
aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789+/aBcDeFgHiJkLmNoPqRsTuVwXyZ012

Base64 encoding alphabet. Used for session tokens, JWT, or encoding. Entropy: 384 bits (extremely strong).

CSRF token (32 chars)

Length: 32, Character sets: Uppercase, Lowercase, Numbers
aB3kL9mP2qR5tY8uV7xW4zA1bC6dE2fG

Alphanumeric (no symbols). Used for CSRF tokens, nonces, or challenge strings. Entropy: ~190 bits.

Technical reference

Random string generation specifications:

Algorithm
Uses Web Crypto API (window.crypto.getRandomValues). Cryptographically secure random (CSPRNG). Generates random bytes, maps to character set using rejection sampling (uniform distribution).
Character sets
Uppercase: A-Z (26 chars), Lowercase: a-z (26 chars), Numbers: 0-9 (10 chars), Symbols: !@#$%^&*()_+-=[]{}|;:',.<>?/ (32 chars). Total: 94 chars (full set).
Length range
8 to 128+ characters. Minimum 8 (weak), 12 (medium), 16+ (strong). API keys: 32-64 chars. Tokens: 64-128 chars.
Ambiguous characters
Excluded when enabled: 0 (zero), O (oh), 1 (one), I (capital i), l (lowercase L), 5, S, 8, B. Reduces confusion for manual entry.
Password policies
Minimum requirements: at least 1 uppercase, 1 lowercase, 1 number, 1 symbol. Tool regenerates until requirements met (max 100 attempts, then fails with error).
Entropy calculation
Entropy = log2(charset_size^length). Example: 16 chars, 94-char set = log2(94^16) = 105 bits. 128+ bits = cryptographically strong.
Bulk generation
1 to 1000+ strings. Browser limit ~10,000 (memory). For huge lists (1M+), use server-side generation.
Export formats
CSV (comma-separated, quoted), JSON (array of strings), plain text (one per line). Copy or download.
Math.random vs Crypto
Math.random() = pseudo-random (predictable). Crypto.getRandomValues = cryptographically secure (unpredictable). Always use Crypto for passwords/keys.
Browser support
Web Crypto API supported in all modern browsers (Chrome, Firefox, Safari, Edge). IE 11+ (with msCrypto fallback).

Common mistakes to avoid

Using Math.random() instead of crypto.getRandomValues() for passwords or keys

Why it happens: Math.random() is pseudo-random (predictable with seed knowledge). Attackers can predict output if they know seed or previous values. Not suitable for passwords, API keys, tokens. Common in old tutorials or quick hacks.

How to avoid it: Use window.crypto.getRandomValues (Web Crypto API) for security. Example: crypto.getRandomValues(new Uint8Array(16)). Cryptographically secure (unpredictable). NEVER use Math.random for passwords.

Creating short passwords (<12 chars), making brute force easy

Why it happens: 8-char password with 94-char set = 52 bits entropy (crackable in hours with GPU). 12-char = 78 bits (days), 16-char = 105 bits (centuries). Shorter = easier to crack.

How to avoid it: Use 16+ characters for passwords. 12 minimum for medium security. 8 is too weak (even with symbols). Longer = exponentially harder to crack.

Not excluding ambiguous characters (0/O, 1/I/l) for manual entry

Why it happens: Users confuse 0 (zero) and O (oh), 1 (one) and I/l (capital i, lowercase L). Causes login failures, support tickets, frustration. Common in license keys or passwords typed manually.

How to avoid it: Enable 'Exclude ambiguous' option for strings users must type (license keys, temporary passwords). For API keys (copy-paste), include all characters for more entropy.

Not enforcing password policies (1 uppercase, 1 number, 1 symbol), causing rejected passwords

Why it happens: Random generation may produce 'aaaaaaaaaaaaaaaa' (all lowercase, no numbers/symbols). Some sites reject this. User regenerates manually (annoying). Common when not checking requirements.

How to avoid it: Enable 'Minimum requirements' option: at least 1 uppercase, 1 lowercase, 1 number, 1 symbol. Tool regenerates until requirements met. Ensures compliance with password policies.

Storing passwords in plain text instead of hashing

Why it happens: This tool generates passwords, but you must hash them before storing (bcrypt, Argon2, PBKDF2). Storing plain text = security disaster (data breach exposes all passwords). Common beginner mistake.

How to avoid it: Hash passwords before storing: bcrypt.hash(password, 12). Never store plain text. Use password managers (1Password, Bitwarden) for personal use. For apps, hash with bcrypt/Argon2.

Frequently asked questions

What is the difference between Math.random() and crypto.getRandomValues()?

Math.random() = pseudo-random (predictable with seed, not secure). crypto.getRandomValues() = cryptographically secure (unpredictable, secure for passwords/keys). Always use crypto for security.

How long should my password be?

16+ characters for strong security. 12 minimum for medium. 8 is too weak (even with symbols). Longer = exponentially harder to crack. Use password manager for 32+ char passwords.

What are ambiguous characters and should I exclude them?

Ambiguous: 0/O (zero/oh), 1/I/l (one/I/L), 5/S, 8/B. Exclude for manual entry (license keys, temp passwords). Include for API keys (copy-paste, more entropy).

How do I generate API keys or tokens?

Use 32-64 characters, Hex (0-9a-f) or Base64 (A-Za-z0-9+/). Example: 32-char hex = 128 bits entropy (secure). For JWT, use 64-char base64 = 384 bits (very secure).

Can I enforce password policies (1 uppercase, 1 number, 1 symbol)?

Yes. Enable 'Minimum requirements' option. Tool regenerates until requirements met (at least 1 uppercase, 1 lowercase, 1 number, 1 symbol). Ensures compliance with password policies.

Is this random enough for cryptography or security?

Yes. Uses window.crypto.getRandomValues (Web Crypto API), which is cryptographically secure. Suitable for passwords, API keys, tokens, session IDs. NOT Math.random (not secure).

How do I export random strings to a file?

Click Export → CSV/JSON/Text. Download file or copy to clipboard. CSV for Excel, JSON for code, Text for plain lists. Useful for bulk passwords or API keys.

References

Privacy and availability

  • Runs entirely in your browser — zero server processing
  • No signup or account required
  • Works offline once loaded
  • Fast, lightweight, no external dependencies
  • Available as a browser extension for Chrome and Firefox