Generate secure passwords with customizable length and complexity
Minimum 4, Maximum 128
A strong password generator creates high-entropy random passwords using cryptographically secure random number generators. Strong passwords combine length (12+ characters), character variety (uppercase, lowercase, digits, symbols), and true randomness to resist brute-force attacks and dictionary attacks.
The generator uses crypto.getRandomValues() (or equivalent CSPRNG) to select characters randomly from defined character sets. Each character position is independently random, ensuring uniform distribution. The resulting password has entropy equal to log2(charset_size^length) bits.
Password strength is measured in entropy bits. Using 94 printable ASCII characters, each character adds ~6.5 bits of entropy. A 16-char password has ~104 bits, which would take billions of years to brute-force. Avoid patterns, dictionary words, and predictable substitutions (@ for a) which reduce effective entropy.
Generate strong passwords for websites and applications.
Xk9#mP2$vL5@nQ8&Create secure passwords for database users.
Generate high-entropy secrets for application configuration.
Generate temporary passwords for new user accounts.
Create strong WPA2/WPA3 passwords for wireless networks.
function generatePassword(length = 16, options = {}) {
const lowercase = 'abcdefghijklmnopqrstuvwxyz';
const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const digits = '0123456789';
const symbols = '!@#$%^&*()_+-=[]{}|;:,.<>?';
let chars = '';
if (options.lowercase !== false) chars += lowercase;
if (options.uppercase !== false) chars += uppercase;
if (options.digits !== false) chars += digits;
if (options.symbols) chars += symbols;
const array = new Uint32Array(length);
crypto.getRandomValues(array);
return Array.from(array, x => chars[x % chars.length]).join('');
}
// Generate 16-char password with all character types
const password = generatePassword(16, { symbols: true });Uses crypto.getRandomValues() for secure randomness. Modulo bias is negligible for small character sets.
import secrets
import string
def generate_password(length=16, use_symbols=True):
chars = string.ascii_letters + string.digits
if use_symbols:
chars += string.punctuation
return ''.join(secrets.choice(chars) for _ in range(length))
# Generate secure password
password = generate_password(16, use_symbols=True)
# Ensure at least one of each type
def generate_strong_password(length=16):
chars = string.ascii_letters + string.digits + string.punctuation
while True:
password = ''.join(secrets.choice(chars) for _ in range(length))
if (any(c.islower() for c in password) and
any(c.isupper() for c in password) and
any(c.isdigit() for c in password) and
any(c in string.punctuation for c in password)):
return passwordsecrets module is cryptographically secure. Never use random module for passwords.
Generate passwords whenever creating new accounts, changing old passwords, setting up services, or any time you need a secure secret. Always use for high-security accounts like email, banking, and password managers.
Minimum 12 characters, preferably 16+. Each character multiplies the keyspace. A 12-char password with mixed case, digits, and symbols has 12^94 ≈ 475 trillion trillion combinations. 16 characters is effectively uncrackable by brute force.