How to Generate a Strong Password: 12 or 16 Characters, Passphrases and NIST
A strong password is one an attacker cannot guess, even with a list of every password ever leaked and hardware that tests billions of guesses per second. That comes almost entirely from length and randomness, not from swapping letters for symbols. Below: how strong a password needs to be (12 characters, 16 or more), how random passwords compare with passphrases, and what the 2025 revision of the NIST guidelines actually requires.
Why length and randomness are what count
Attackers do not try every combination in order. They start with leaked passwords, dictionary words and the patterns people use: a capital first letter, a number and a ! at the end, @ for a, 0 for o. P@ssw0rd2026! satisfies most old complexity rules and falls in seconds, because it is a dictionary word with predictable substitutions.
A password generated at random has no pattern to exploit, so its strength is measurable. Each character drawn from an alphabet of N symbols adds logâ‚‚(N) bits of entropy:
characters used bits/char 12 chars 16 chars 20 chars
lower case (26) 4.7 56 75 94
letters + digits (62) 5.95 71 95 119
all printable ASCII (94) 6.55 79 105 131
The table shows why length wins. Sixteen characters of letters and digits carry about 95 bits; twelve characters from the full keyboard carry about 79. That gap of roughly 16.6 bits means around 100,000 times more guesses for the longer password with the smaller alphabet, and it is easier to type on a phone.
How many characters: 12, 16 or more?
For a random password stored in a password manager, 16 or more characters is a comfortable default: around 95 bits with letters and digits, far beyond any offline cracking. Twelve random characters from the full keyboard, about 79 bits, is acceptable for most accounts. Anything shorter than 12 is weak against offline attacks if the service stores passwords with a fast hash.
NIST SP 800-63B, revised in August 2025, now requires services to accept passwords of at least 15 characters when the password is the only factor. Eight is allowed only when the password is combined with multi-factor authentication. Services should also permit at least 64 characters. If a site rejects your long password, that is a flaw in the site, not in the password.
Random passwords vs passphrases
A random character password such as k7Rw2pXq9LmT4vNz is the strongest per character, and the right choice for anything a password manager fills in for you.
A passphrase is several random words, such as ranch-oyster-lyric-canopy-sprint-mellow. It is longer but much easier to remember and to type on a phone or a TV remote. Its strength depends only on how the words were chosen. Picked at random from the EFF long wordlist of 7,776 words, each word adds about 12.9 bits: five words give about 65 bits and six give about 77. Words chosen by a person, song lyrics or famous quotes are far weaker, because attackers use phrase lists too.
Use passphrases for the few passwords you must remember, such as your password manager's master password and your computer login. Use random passwords from a password manager for everything else.
Generating one securely
A password generator must use a cryptographically secure random source. Math.random() and similar functions are predictable. Browser-based generators that use crypto.getRandomValues() never send the password anywhere.
# macOS / Linux
openssl rand -base64 18 # 24 characters
LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 20; echo
# Python
python3 -c "import secrets; print(secrets.token_urlsafe(16))"
// Browser or Node.js: random password from a chosen alphabet
function generatePassword(length = 16, alphabet =
'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789') {
const out = [];
const max = 256 - (256 % alphabet.length); // avoid modulo bias
while (out.length < length) {
const [b] = crypto.getRandomValues(new Uint8Array(1));
if (b < max) out.push(alphabet[b % alphabet.length]);
}
return out.join('');
}
The loop discards bytes above the largest multiple of the alphabet size. Without that step, some characters would appear slightly more often than others, a subtle bias many hand-written generators have.
What NIST says about the old rules
The 2025 revision of SP 800-63B is explicit. Services must not impose composition rules such as "one upper case, one digit, one symbol", because they push people towards predictable patterns. They must not force periodic password changes, which lead to Summer2025! becoming Autumn2025!. They must force a change when there is evidence of compromise.
They must also check new passwords against a blocklist of common, expected and breached passwords. That rule does the most good in practice, because it rejects exactly the passwords attackers try first.
Checking a password against breaches
Have I Been Pwned's Pwned Passwords service lists hundreds of millions of passwords seen in breaches. Its API uses k-anonymity: you send only the first five characters of the password's SHA-1 hash and compare the returned list locally, so the password itself never leaves your machine. Password managers and many sign-up forms use it.
hash=$(printf '%s' 'P@ssw0rd2026!' | shasum -a 1 | awk '{print toupper($1)}')
curl -s "https://api.pwnedpasswords.com/range/${hash:0:5}" | grep "${hash:5}"
# a match prints the suffix and how many times it appeared in breaches
A password that appears in a breach list should never be used, however complex it looks.
Sources and further reading
NIST Special Publication 800-63B (revision 4, 2025) sets the length, composition, rotation and blocklist rules quoted above. The EFF publishes its long wordlist for passphrases. Have I Been Pwned documents the Pwned Passwords k-anonymity API. MDN documents crypto.getRandomValues(), and the Python secrets module documentation covers secure generation.
Frequently asked questions
How long should a strong password be?
At least 12 random characters, and preferably 16 or more when a password manager stores it. NIST now requires services to accept at least 15 characters for passwords used without multi-factor authentication.
Is a 12-character password strong enough?
A truly random 12-character password using letters, digits and symbols has about 79 bits of entropy, which is strong for most accounts. A 12-character password based on a word with substitutions is not.
Are passphrases better than random passwords?
They are easier to remember and type, and six random words from a large list are about as strong as a random 12-character password. For passwords stored in a manager, random characters are shorter for the same strength.
Do passwords need symbols and numbers?
No. Length and randomness matter far more, and NIST says services should not require character mixes. A longer password of letters and digits is stronger than a shorter one with symbols.
Should I change my passwords regularly?
Not on a schedule. NIST advises against forced periodic changes; change a password when there is a sign it was compromised, such as appearing in a breach.
Are online password generators safe?
Yes, if they generate in your browser with `crypto.getRandomValues()` and never send the result to a server. Password managers have secure generators built in.