Weak passwords remain the number one cause of account breaches. Despite decades of security awareness, "123456" and "password" still top the most-common-passwords list every year. This guide explains how password security actually works, how to generate truly strong passwords, and why passwords alone are no longer enough.
Password strength comes down to one concept: entropy — the measure of unpredictability in bits. Higher entropy means more possible combinations an attacker must try.
Entropy (bits) = log2(character_set_size ^ password_length)
Example: 12-character password using uppercase + lowercase + digits + symbols
Character set: 26 + 26 + 10 + 32 = 94 characters
Entropy: log2(94^12) = 78.7 bits
Example: 8-character lowercase-only password
Character set: 26 characters
Entropy: log2(26^8) = 37.6 bits
| Entropy (bits) | Strength | Time to Crack (10B guesses/sec) |
|---|---|---|
| < 28 | Very Weak | Seconds |
| 28 - 35 | Weak | Minutes to hours |
| 36 - 59 | Moderate | Days to years |
| 60 - 79 | Strong | Thousands of years |
| 80 - 99 | Very Strong | Millions of years |
| 100+ | Excellent | Heat death of universe |
Modern hardware (GPU clusters) can test billions of password guesses per second against fast hashes like MD5 or SHA-256. However, properly hashed passwords (bcrypt, Argon2) slow this down to thousands per second. See the hash generator guide for details on proper password hashing.
Generated from a pool of characters with cryptographic randomness:
# Examples of strong random passwords:
Kx9#mP2$vL7@nQ4 (16 chars, ~105 bits entropy)
aR3!bZ8*cF5&dH1 (16 chars, ~105 bits entropy)
j7Ym$Np2Wx9!Kv4R (16 chars, ~105 bits entropy)
Pros: Maximum entropy per character. Compact.
Cons: Impossible to memorize. Must use a password manager.
Four to six randomly selected words from a large wordlist:
# Examples of strong passphrases:
correct-horse-battery-staple (4 words, ~44 bits)
marble-piano-thunder-ketchup-orbit (5 words, ~64 bits)
glacier-velvet-compass-tornado-puzzle-rhythm (6 words, ~77 bits)
Pros: Much easier to type and remember. Resistant to brute force.
Cons: Longer. Fewer bits per character (but still strong with enough words).
| Scenario | Recommendation |
|---|---|
| Stored in password manager | Random 16-20 character password |
| Master password (must memorize) | 5-6 word passphrase |
| Server/database credentials | Random 32+ character password |
| WiFi password | Random 20+ chars or 4-word passphrase |
| API keys and tokens | Random 32-64 character hex/alphanumeric |
# Linux/macOS - generate 20-character random password
openssl rand -base64 20 | tr -d '/+=' | head -c 20
# Using /dev/urandom
cat /dev/urandom | tr -dc 'A-Za-z0-9!@#$%' | head -c 20
# Python
python3 -c "import secrets, string; print(''.join(secrets.choice(string.ascii_letters + string.digits + '!@#$%') for _ in range(20)))"
# Node.js
node -e "const c=require('crypto');console.log(c.randomBytes(20).toString('base64url').slice(0,20))"
A password manager solves the fundamental conflict between security (unique, complex passwords for every account) and usability (remembering them all). Here is what a good password manager provides:
Recommended managers: Bitwarden (open source), 1Password, KeePassXC (offline).
Even the strongest password can be compromised through phishing, keyloggers, or server-side breaches. Two-factor authentication adds a second layer that requires something you have (a device) in addition to something you know (the password).
| Method | Security | Notes |
|---|---|---|
| Hardware keys (YubiKey, Titan) | Excellent | Phishing-proof. Gold standard for high-value accounts. |
| Passkeys (WebAuthn/FIDO2) | Excellent | Built into OS/browser. Phishing-resistant. |
| TOTP apps (Authy, Google Auth) | Good | Time-based codes. Works offline. |
| Push notifications | Good | Convenient but vulnerable to prompt bombing. |
| SMS codes | Acceptable | Vulnerable to SIM swapping. Better than nothing. |
| Email codes | Weak | Only as secure as your email account. |
# Server-side password storage (Python example)
import bcrypt
# Hashing a password (during registration)
password = b"user_password_here"
hashed = bcrypt.hashpw(password, bcrypt.gensalt(rounds=12))
# Store 'hashed' in database
# Verifying a password (during login)
if bcrypt.checkpw(password, stored_hash):
# Generate JWT session token
pass
Use JWT tokens for session management after authentication. Store secrets securely with proper file permissions (600 for .env files).
At minimum 12 characters with mixed character types, but 16-20 characters is recommended. For master passwords and encryption keys, use 20+ characters or a 5+ word passphrase.
A 5-word Diceware passphrase (~64 bits entropy) is significantly stronger than a typical 8-character complex password (~40 bits entropy). Length beats complexity because entropy scales exponentially with length.
Absolutely yes. This is the single most important password security practice. When a service is breached (and they are, regularly), unique passwords ensure the damage does not spread.
Yes. Strong passwords protect against brute force but not against phishing, malware, or server-side breaches. 2FA is your defense-in-depth layer. Enable it on every account that supports it, especially email, banking, and cloud services.
Try Password Generator Now →DevToolKit — 42+ Free Online Developer Tools