The current NIST password guidelines are in SP 800-63B-4, finalized in July 2025. They require passwords of at least 15 characters when the password is the only factor (8 when it is part of MFA), let users enter at least 64 characters, and forbid composition rules like "one uppercase, one symbol". Mandatory periodic resets are also out. Verifiers must screen new passwords against a blocklist of breached and common passwords, allow password managers and paste, rate-limit failed logins, and store passwords salted and hashed with a memory-hard or iterated scheme. This guide quotes the actual SHALL and SHOULD rules and turns them into working Python.
Where the NIST password guidelines live now
NIST Special Publication 800-63 is the US federal digital identity standard. Volume B covers authentication. The fourth revision, SP 800-63B-4, is marked final on NIST's CSRC site with a July 2025 publication date, and it supersedes the 2017 SP 800-63B (last updated March 2020). The readable HTML version is at pages.nist.gov/800-63-4.
Password requirements are in Section 3.1.1. Rate limiting is in Section 3.2.2. The standard binds US federal agencies, but auditors, cyber-insurance questionnaires and enterprise security reviews increasingly use it as the reference for "good password policy", so private-sector teams end up implementing it too.
A note on vocabulary: NIST uses SHALL for requirements, SHOULD for recommendations, and MAY for options. The difference matters when you are deciding what to ship first.
The NIST password rules: SHALL vs SHOULD
Everything below is quoted or closely paraphrased from Section 3.1.1 of SP 800-63B-4.
| Topic | NIST 800-63B-4 says | Strength |
|---|---|---|
| Minimum length, password as the only factor | Minimum of 15 characters | SHALL |
| Minimum length, password used only within MFA | MAY be shorter, but minimum of 8 characters | SHALL |
| Maximum length | Permit at least 64 characters | SHOULD |
| Counting characters | Each Unicode code point counts as one character | SHALL |
| Character set | Accept all printing ASCII plus space; accept Unicode | SHOULD |
| Normalization | Apply NFC normalization before hashing | SHOULD |
| Truncation | Verify the entire password, never a subset | SHALL |
| Composition rules | "Other composition requirements for passwords SHALL NOT be imposed" | SHALL NOT |
| Periodic change | Do not require periodic changes; force a change on evidence of compromise | SHALL NOT / SHALL |
| Hints and security questions | No hints accessible to unauthenticated users; no KBA or security questions when choosing passwords | SHALL NOT |
| Blocklist | Compare the full prospective password against a blocklist; reject with a reason | SHALL |
| Guidance | Offer guidance to help users choose a strong password | SHALL |
| Password managers and autofill | Allow them | SHALL |
| Paste | Permit paste | SHOULD |
| Show password | Offer an option to display the password | SHOULD |
| Rate limiting | Limit failed attempts per account | SHALL |
| Storage | Salted and hashed with a suitable password hashing scheme | SHALL |
Two details people miss.
The blocklist must compare the entire password, not substrings. NIST explicitly says "The entire password SHALL be subject to comparison, not substrings or words that might be contained therein." Rejecting "correcthorsebatterystaple" because it contains "horse" is not what the standard asks for. NIST's examples of what a blocklist may include are passwords from previous breach corpuses, dictionary words, and context-specific words such as the name of the service, the username, and derivatives of them.
The 15-character minimum only applies when the password stands alone. If every account is protected by a second factor, NIST allows an 8-character minimum. Most consumer apps make MFA optional, which means the password is single-factor for many users, so 15 is the safe default.
What changed from the old NIST password guidance
If your policy was written against the 2017 version, these are the shifts that matter:
| Area | SP 800-63B (2017) | SP 800-63B-4 (2025) |
|---|---|---|
| Minimum length | 8 characters | 15 single-factor, 8 within MFA |
| Composition rules | SHOULD NOT impose | SHALL NOT impose |
| Periodic rotation | SHOULD NOT require | SHALL NOT require |
| Password managers | Paste SHOULD be permitted | Password managers and autofill SHALL be allowed |
| Unicode normalization | NFKC or NFKD | NFC, applied before hashing |
| Phishing | Discussed | States plainly: "Passwords are not phishing-resistant" |
The practical effect: the "recommended" items from 2017 are now hard requirements. A policy that forces 90-day rotation or demands a symbol is out of compliance, not just out of fashion.
Old password policy vs NIST: a quick audit
Run your current policy through this table.
| Common policy | NIST verdict | Fix |
|---|---|---|
| "8–16 characters" | Non-compliant max and (for single-factor) min | Min 15 (or 8 with mandatory MFA), max at least 64 |
| "Must contain uppercase, number and symbol" | SHALL NOT | Remove; use blocklist and length instead |
| "Expires every 90 days" | SHALL NOT | Remove; force reset only on evidence of compromise |
| "What was your first pet's name?" at signup | SHALL NOT | Remove security questions |
| Paste disabled on password field | Violates SHOULD and undermines managers | Allow paste and autofill |
| Silently truncating at 20 or 72 bytes | SHALL NOT (must verify entire password) | Hash the full input; see bcrypt note below |
| Account locks after 5 attempts forever | Allowed, but heavy-handed | Per-account throttling with backoff, hard limit of no more than 100 |
Implementing NIST password guidelines in Python
The code below covers the verifier side: length rules with Unicode counting, NFC normalization, a context-aware blocklist, a Have I Been Pwned breach check, Argon2id hashing, and per-account throttling. It runs on Python 3.12 with argon2-cffi 25.1.0 and was tested as written.
Step 1: Length, normalization and blocklist
Save this as password_policy.py:
import hashlib
import unicodedata
import urllib.request
from dataclasses import dataclass, field
MIN_LEN_SINGLE_FACTOR = 15 # SP 800-63B-4 §3.1.1.2: password is the only factor
MIN_LEN_WITH_MFA = 8 # password used only as part of MFA
MAX_LEN = 128 # NIST: permit at least 64; pick something generous
# Load a real list in production (e.g. top 100k breached passwords); tiny demo here.
COMMON = {"password", "123456789012345", "qwertyuiopasdfg", "passwordpassword"}
@dataclass
class PolicyResult:
ok: bool
reasons: list[str] = field(default_factory=list)
def normalize(pw: str) -> str:
"""NFC-normalize before length checks and hashing (SP 800-63B-4 §3.1.1.2)."""
return unicodedata.normalize("NFC", pw)
def pwned_count(pw: str, timeout: float = 3.0) -> int:
"""Have I Been Pwned range API with k-anonymity: only 5 hex chars leave the server."""
sha1 = hashlib.sha1(pw.encode("utf-8")).hexdigest().upper()
prefix, suffix = sha1[:5], sha1[5:]
req = urllib.request.Request(
f"https://api.pwnedpasswords.com/range/{prefix}",
headers={"Add-Padding": "true", "User-Agent": "example-app-password-check"},
)
with urllib.request.urlopen(req, timeout=timeout) as resp:
for line in resp.read().decode().splitlines():
candidate, _, count = line.partition(":")
if candidate == suffix:
return int(count) # padded rows have count 0
return 0
def check_password(pw: str, *, username: str, service: str, mfa: bool = False) -> PolicyResult:
pw = normalize(pw)
reasons = []
min_len = MIN_LEN_WITH_MFA if mfa else MIN_LEN_SINGLE_FACTOR
if len(pw) < min_len: # len() counts code points, which is what NIST asks for
reasons.append(f"Use at least {min_len} characters.")
if len(pw) > MAX_LEN:
reasons.append(f"Use at most {MAX_LEN} characters.")
lowered = pw.casefold()
context = {username.casefold(), service.casefold()}
if lowered in COMMON or lowered in context:
reasons.append("That password is too common or matches your account details.")
if not reasons:
try:
if pwned_count(pw) > 0:
reasons.append("That password has appeared in a data breach. Choose another.")
except OSError:
pass # fail open on network errors, but log it in real code
return PolicyResult(ok=not reasons, reasons=reasons)
Running it:
>>> check_password("short", username="ada", service="acme")
PolicyResult(ok=False, reasons=['Use at least 15 characters.'])
>>> check_password("correct horse battery staple", username="ada", service="acme")
PolicyResult(ok=False, reasons=['That password has appeared in a data breach. Choose another.'])
>>> check_password("tangerine-oscilloscope-velvet-91", username="ada", service="acme")
PolicyResult(ok=True, reasons=[])
>>> pwned_count("password")
52373976
Notes on the choices:
- Why
len()after NFC. Python'slen()counts code points, which matches NIST's counting rule. Normalizing first means "é" typed as one precomposed character and "e" plus a combining accent produce the same string, the same length and the same hash. - Why the rejection reason is specific. NIST requires you to tell users why a password was rejected. "Appeared in a data breach" is actionable; "invalid password" is not.
- Fail open or closed? If the breach API is unreachable, this code accepts the password. That keeps signups working during an outage. Log it and decide based on your risk tolerance.
Step 2: Check breached passwords with k-anonymity
The Pwned Passwords range API is the standard way to meet the "previous breach corpuses" part of the blocklist without sending passwords anywhere. You SHA-1 the password, send only the first five hex characters to https://api.pwnedpasswords.com/range/{prefix}, and compare the returned suffixes locally. Each response line is SUFFIX:COUNT.
Details from the API docs that matter in production:
- No API key or subscription is required, and there is no rate limit on Pwned Passwords.
- Send
Add-Padding: true. The response is padded to a random 800 to 1,000 records with fake entries whose count is 0, so an observer can't infer much from response size. Discard zero-count rows, which the code above does implicitly because it only matches on your suffix. - A
?mode=ntlmvariant exists for NTLM hashes if you are auditing Active Directory.
If you can't call an external service, download the corpus and serve the same range lookup internally, or ship a local list of the most common breached passwords. NIST's requirement is the comparison, not the provider.
Step 3: Hash with Argon2id per OWASP
NIST requires salted hashing with a "suitable password hashing scheme", a salt of at least 32 bits, and a cost factor "as high as practical". It defers to SP 800-132 or newer NIST guidance on which schemes are approved. For concrete parameters, most teams follow the OWASP Password Storage Cheat Sheet:
| Algorithm | OWASP minimum configuration |
|---|---|
| Argon2id | m=19456 (19 MiB), t=2, p=1, or m=47104 (46 MiB), t=1, p=1, or other listed equivalents |
| scrypt | N=2^17 (128 MiB), r=8, p=1, or listed equivalents |
| bcrypt | Work factor of at least 10, with a 72-byte input limit |
| PBKDF2 | HMAC-SHA256 at 600,000 iterations, or HMAC-SHA512 at 220,000 |
PBKDF2-HMAC-SHA256 is the FIPS-friendly option if you must stay inside FIPS 140 validated modules. Otherwise Argon2id is OWASP's first choice.
from argon2 import PasswordHasher, Type
from argon2.exceptions import VerifyMismatchError, InvalidHashError
from password_policy import normalize
# OWASP minimum for Argon2id: m=19456 KiB (19 MiB), t=2, p=1. Tune upward on your hardware.
ph = PasswordHasher(time_cost=2, memory_cost=19456, parallelism=1, type=Type.ID)
def hash_password(pw: str) -> str:
return ph.hash(normalize(pw)) # encoded string carries salt + parameters
def verify_password(stored: str, pw: str) -> tuple[bool, str | None]:
"""Returns (ok, new_hash_if_parameters_changed)."""
try:
ph.verify(stored, normalize(pw))
except (VerifyMismatchError, InvalidHashError):
return False, None
if ph.check_needs_rehash(stored):
return True, ph.hash(normalize(pw))
return True, None
The output looks like $argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash>. That encoded string stores the algorithm, cost parameters and a 16-byte salt, which satisfies NIST's SHOULD to record the scheme and cost factor with each password. check_needs_rehash lets you raise the cost later and upgrade hashes as users log in, which is how you follow NIST's advice to increase cost over time. Note that argon2-cffi's own default profile (RFC 9106 low-memory: t=3, 64 MiB, p=4) is stronger than the OWASP floor. Benchmark on production hardware and go as high as login latency allows.
The bcrypt trap. bcrypt only uses the first 72 bytes of input. A 64-character password made of multi-byte Unicode characters can easily exceed 72 bytes, and older libraries silently truncated it, which violates NIST's "verify the entire password" rule. The Python bcrypt 5.0.0 package now raises ValueError: password cannot be longer than 72 bytes instead. If you're stuck with bcrypt, OWASP's suggested workaround is bcrypt(base64(hmac-sha384(password, pepper)), salt, cost). For new systems, pick Argon2id and avoid the issue.
Peppering. NIST also recommends an extra keyed hashing or encryption step with a secret key "stored separately from the hashed passwords", ideally in hardware-protected storage. In practice that means a KMS or HSM key used to encrypt the stored hash, or an HMAC pepper applied before hashing. OWASP's view is that a pepper adds defense in depth but provides no security on its own.
Step 4: Rate limiting failed logins
Section 3.2.2 requires verifiers to limit consecutive failed attempts on a single account to no more than 100, and suggests techniques that reduce lockout of legitimate users: bot-detection challenges, increasing waits after failures, and risk-based or adaptive checks.
import time
MAX_CONSECUTIVE_FAILURES = 100 # SP 800-63B-4 §3.2.2 ceiling; pick lower if you like
BASE_DELAY_SECONDS = 1
class LoginThrottle:
"""Per-account failure counter with growing delay. Use Redis or your DB in production."""
def __init__(self):
self.failures: dict[str, int] = {}
self.next_allowed: dict[str, float] = {}
def check(self, account_id: str) -> str:
if self.failures.get(account_id, 0) >= MAX_CONSECUTIVE_FAILURES:
return "disabled" # require recovery / admin reset
if time.monotonic() < self.next_allowed.get(account_id, 0):
return "wait"
return "ok"
def record_failure(self, account_id: str) -> None:
n = self.failures.get(account_id, 0) + 1
self.failures[account_id] = n
delay = min(BASE_DELAY_SECONDS * 2 ** (n - 1), 15 * 60) # cap at 15 minutes
self.next_allowed[account_id] = time.monotonic() + delay
def record_success(self, account_id: str) -> None:
self.failures.pop(account_id, None)
self.next_allowed.pop(account_id, None)
Per-account limits stop online guessing against one user. They do not stop credential stuffing, where an attacker tries one password each across thousands of accounts. Pair them with IP and device-level rate limits and bot detection at the edge.
Step 5: The front end
Most NIST requirements on the client side are about not getting in the way:
<label for="new-password">Password (15+ characters)</label>
<input id="new-password" name="password" type="password"
autocomplete="new-password" minlength="15" maxlength="128" required>
<button type="button" id="toggle">Show password</button>
<p id="password-feedback" aria-live="polite"></p>
autocomplete="new-password"tells password managers to offer a generated password. Usecurrent-passwordon the login form.- Don't block paste, and don't add JavaScript that interferes with autofill.
- Offer a show-password toggle, which NIST recommends.
- Show the server's specific rejection reason in the feedback element.
A strength meter is a reasonable way to meet the SHALL to "offer guidance". Estimators like zxcvbn give better feedback than character-class checklists, but don't turn the meter into a hidden composition rule. Our free strong password checker shows the kind of feedback that helps users pick long, uncommon passwords.
Beyond the password itself
The NIST password guidelines are the floor, not the ceiling. The same document states that passwords are not phishing-resistant, so for high-value accounts the bigger win is moving users to MFA and, where possible, phishing-resistant authenticators like passkeys. If you're choosing a platform rather than building, our comparisons of customer identity (CIAM) platforms and workforce identity and access management cover vendors that implement these rules for you. If you're building on an open-source auth library, our Better Auth vs Auth.js comparison looks at what each handles out of the box. Password policy is also one control within a broader zero trust architecture, where every authentication decision is backed by device and context signals.
Frequently Asked Questions
What is the minimum password length under NIST guidelines?
Under SP 800-63B-4, passwords used as the only authentication factor SHALL be at least 15 characters. Passwords used only as part of multi-factor authentication may be shorter, but SHALL be at least 8 characters. Each Unicode code point counts as one character.
Does NIST still recommend changing passwords every 90 days?
No. SP 800-63B-4 says verifiers SHALL NOT require users to change passwords periodically. They SHALL force a change when there is evidence the password has been compromised, such as it appearing in a breach.
Does NIST require special characters in passwords?
No. Composition rules such as requiring a mix of uppercase, lowercase, digits and symbols SHALL NOT be imposed. NIST relies on length and blocklist screening instead.
What is the maximum password length NIST recommends?
NIST says verifiers SHOULD permit a maximum length of at least 64 characters and SHALL verify the entire password without truncating it. Allowing 128 or more leaves comfortable room for passphrases and password-manager output.
Is SP 800-63B-4 final?
Yes. NIST's CSRC page lists SP 800-63B-4 as final, published July 2025, superseding the 2017 SP 800-63B. NIST has since published supplemental implementation resources, which don't change the normative requirements.
Is bcrypt still acceptable under NIST guidelines?
NIST requires a suitable salted password hashing scheme and points to SP 800-132 for approved schemes. OWASP still lists bcrypt with a work factor of at least 10, but its 72-byte input limit conflicts with long Unicode passwords. Argon2id, scrypt or PBKDF2 avoid that problem.
Conclusion
The NIST password guidelines now read like a list of things to stop doing: stop forcing symbols, stop forcing rotation, stop blocking paste, stop truncating. What remains is short: 15 characters minimum for single-factor use, at least 64 allowed, NFC normalization, full-password blocklist and breach screening, per-account throttling, and salted, memory-hard hashing with a cost you raise over time. The Python above covers all of it in about a hundred lines. The harder work is deleting the old rules from your forms and policies.