Last updated
Random String Generator Examples
The Random String Generator creates random strings of any length and character composition for passwords, tokens, identifiers, and test data. Below are practical examples for common use cases.
Alphanumeric String
Generate a general-purpose alphanumeric string:
Character set: Alphanumeric (a-z, A-Z, 0-9)
Length: 16
Result: aK7mPx3nQr9wLt2v
Alphanumeric strings are the most versatile — safe for URLs, filenames, and most contexts without escaping.
Lowercase Only
Generate a lowercase identifier:
Character set: Lowercase (a-z)
Length: 8
Result: qrtmxpwn
Useful for generating simple identifiers, slugs, or codes that need to be case-insensitive.
Digits Only — PIN Code
Generate a 6-digit PIN code:
Character set: Digits (0-9)
Length: 6
Result: 847291
Password with Special Characters
Generate a strong password with mixed characters:
Character set: Alphanumeric + Special (!@#$%^&*)
Length: 20
Result: aK7m!Px3#nQr9@wLt2v$
Including special characters significantly increases entropy and meets most password complexity requirements.
Entropy Calculation
Understanding the security strength of different configurations:
16 chars, alphanumeric (62 chars):
Entropy = 16 × log2(62) ≈ 95 bits — very strong
8 chars, digits only (10 chars):
Entropy = 8 × log2(10) ≈ 27 bits — weak (brute-forceable)
32 chars, alphanumeric (62 chars):
Entropy = 32 × log2(62) ≈ 190 bits — extremely strong
Higher entropy means harder to guess. 80+ bits is generally considered strong for most security applications.
API Key Generation
Generate an API key with a prefix:
Prefix: sk_
Character set: Alphanumeric
Random length: 32
Result: sk_aK7mPx3nQr9wLt2vBcDeFgHiJkLmNoP
API keys often have a prefix that identifies the key type. The prefix is fixed; only the random portion changes.
Public/Private Key Pair Prefixes
Generate keys with type-identifying prefixes:
Secret key: sk_live_aK7mPx3nQr9wLt2vBcDeFgHiJkLmNoP
Public key: pk_live_Qr9wLt2vBcDeFgHiJkLmNoPaK7mPx3n
Test key: sk_test_Lt2vBcDeFgHiJkLmNoPaK7mPx3nQr9w
Session Token
Generate a session token for authentication:
Mode: Cryptographic (Web Crypto API)
Character set: Alphanumeric
Length: 64
Result: aK7mPx3nQr9wLt2vBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcdefghij
Cryptographic mode uses hardware entropy sources, making the token unpredictable even to attackers who know the algorithm.
Activation Code — No Ambiguous Characters
Generate an activation code excluding visually similar characters:
Character set: Alphanumeric
Exclude: 0, O, 1, l, I
Length: 16
Format: XXXX-XXXX-XXXX-XXXX
Result: A7KM-PX3N-QR9W-T2VB
Removing ambiguous characters (0/O, 1/l/I) prevents user errors when typing codes manually.
URL-Safe Token
Generate a token safe for use in URLs without percent-encoding:
Character set: URL-safe (a-z, A-Z, 0-9, -, _)
Length: 32
Result: aK7m-Px3n_Qr9w-Lt2v_BcDe-FgHi_JkLm
URL-safe strings avoid characters that require percent-encoding in query parameters and path segments.
Bulk Generation — Plain List
Generate 5 unique API keys:
sk_aK7mPx3nQr9wLt2vBcDeFgHiJkLmNoP
sk_Qr9wLt2vBcDeFgHiJkLmNoPaK7mPx3n
sk_Lt2vBcDeFgHiJkLmNoPaK7mPx3nQr9w
sk_BcDeFgHiJkLmNoPaK7mPx3nQr9wLt2v
sk_FgHiJkLmNoPaK7mPx3nQr9wLt2vBcDe
Bulk Generation — JSON Array
Generate strings as a JSON array for use in code:
["aK7mPx3nQr9wLt2v", "BcDeFgHiJkLmNoPq", "RsTuVwXyZ0123456", "789abcdefghijklm", "nopqrstuvwxyzABC"]
Bulk Generation — SQL Format
Generate strings as a SQL VALUES clause:
INSERT INTO tokens (token) VALUES
('aK7mPx3nQr9wLt2v'),
('BcDeFgHiJkLmNoPq'),
('RsTuVwXyZ0123456');
Custom Character Set
Generate a string using only hex characters for a hash-like value:
Character set: Custom (0-9, a-f)
Length: 32
Result: 3a7f2c9e1b4d8f0a6e2c5b9d3f7a1e4c
Custom character sets let you generate strings safe for specific contexts — hex for hashes, base64 chars for encoded values, etc.
Database Seeding
Generate unique tokens for seeding a test database:
Quantity: 1000
Character set: Alphanumeric
Length: 24
Unique: yes
Export: tokens.csv
The generator guarantees uniqueness within the generated set, so no duplicate checking is needed before import.
- Choose from lowercase, uppercase, digits, alphanumeric, or special characters
- Set exact string length from 1 to thousands of characters
- Exclude ambiguous characters (0/O, 1/l/I) for user-typed codes
- Add fixed prefix and suffix around the random portion
- Use cryptographic mode for security-sensitive tokens
- View entropy calculation to verify security strength
- Export as plain list, quoted list, JSON array, CSV, or SQL
- Bulk generate thousands of unique strings at once