Explainer
How websites store passwords: hashing, salts and peppers
A well-run website does not keep your password itself: NIST requires services to store passwords salted and hashed with a password hashing scheme that takes the password, a salt and a cost factor as inputs.[1] Hashing is one-way, unlike encryption, so a stolen hash cannot simply be decrypted back into the password.[2] The salt and the deliberately slow hash exist to make each guess expensive for an attacker who steals the password file, though attackers can still test billions of guesses per second offline, which is why weak passwords remain at risk.[3][4]
This page explains how services should store passwords on their side. For protecting your own accounts, see two-factor authentication and passkeys.
Hashing, not storing
NIST’s digital identity guidelines say services that check passwords must store them in a form that resists offline attacks: salted and hashed with a password hashing scheme, which takes the password, a salt and a cost factor and produces a password hash.[1] The OWASP Password Storage Cheat Sheet explains why hashing is used rather than encryption: hashing is a one-way function, whereas encryption is two-way, so anyone who obtains the key can recover the original passwords from encrypted data.[2] Hashing in general is covered in how encryption works, where hash functions produce digests used to detect changes to data.[5]
Salts: one random value per password
A salt is a random value mixed into each password before it is hashed. NIST requires salts of at least 32 bits, chosen so that different accounts do not end up with the same stored hash, and says the salt and the hash are stored together, along with a note of the scheme and cost factor so the service can migrate to stronger settings later.[6]
According to OWASP, a unique salt stops attackers from using precomputed lookup tables such as rainbow tables, and means two users with the same password get different hashes.[7] The PKCS #5 standard notes that a salt need not be kept secret; its job is to select one key from a large set of keys that could be derived from the same password.[8]
Slow on purpose: cost factors and algorithms
Password hashing schemes are built to be slow. NIST says their purpose is to make each guess more expensive for an attacker who has stolen a hashed password file, and that the cost factor should be as high as practical without slowing sign-in too much, and raised as computers get faster.[3]
OWASP’s current recommendation is Argon2id with at least 19 MiB of memory, 2 iterations and 1 degree of parallelism; scrypt if Argon2id is not available; bcrypt with a work factor of 10 or more for legacy systems; and PBKDF2 with 600,000 or more iterations of HMAC-SHA-256 where FIPS-140 compliance is required.[9] Argon2 won the 2015 Password Hashing Competition, and RFC 9106 describes it as a memory-hard function for password hashing.[10]
Peppers: a secret kept elsewhere
Some services add a second layer. NIST recommends an extra keyed hashing or encryption step using a secret key known only to the service, stored separately from the hashed passwords and preferably inside dedicated hardware.[11] OWASP calls this kind of secret a pepper: unlike a salt it is shared by all stored passwords, and it should be kept apart from the database, for example in a secrets vault or hardware security module.[12]
When the database leaks
NIST explains that offline attacks become possible when an attacker steals hashed passwords in a database breach.[4] Because attackers can then compute many billions of hashes per second, with no rate limit, a password has to be far stronger to survive an offline attack than an online one.[4] How data breaches happen covers how such files are stolen.
Online guessing is limited in other ways. NIST requires services to cap consecutive failed attempts on one account at no more than 100,[13] and to reject new passwords that appear on a blocklist of commonly used, expected or compromised passwords.[14] The same guidelines require single-factor passwords to be at least 15 characters and bar forced periodic changes and character-mix rules.[15]
Read next
National Institute of Standards and Technology (NIST)
NIST is the US measurement and standards lab behind official time, the SI units, AES encryption, post-quantum standards and AI and cybersecurity frameworks.
Questions readers ask
Do websites know my password?
They should not keep it. NIST requires services to store passwords salted and hashed in a form resistant to offline attacks, and OWASP says passwords should never be encrypted or kept in plain text but hashed, because hashing is a one-way function.[1][2]
What is a salt?
A salt is a random value combined with each password before hashing. NIST requires it to be at least 32 bits long and stored alongside the hash. A unique salt defeats precomputed rainbow tables and means two people with the same password end up with different hashes. It does not need to be kept secret.[6][7][8]
What is a pepper?
A pepper is an extra secret shared by all stored passwords and kept apart from the password database, for example in a hardware security module. NIST recommends an extra keyed hashing step with a secret key known only to the service and stored separately.[12][11]
Why not use a fast hash like SHA-256?
The point of a password hashing scheme is to make each guess expensive for someone who has stolen the hashed passwords, so its cost factor should be as high as practical. Attackers can compute many billions of hashes per second offline.[3][4]
Which password hashing algorithm is recommended?
OWASP recommends Argon2id with at least 19 MiB of memory, 2 iterations and 1 degree of parallelism, then scrypt, bcrypt for legacy systems and PBKDF2 with 600,000 or more iterations where FIPS-140 compliance is required. Argon2 won the 2015 Password Hashing Competition.[9][10]
If a site is breached, is my hashed password safe?
Not necessarily. Salting and slow hashing raise the cost of guessing, but NIST says attackers working offline can try many billions of hashes per second, so passwords need to be far stronger to resist offline attacks than online ones.[4]
Sources
· 15 claims from 5 publishers
Each numbered claim is a statement we checked against the sources listed with it. Tap a number in the text to see its sources in place.
- [1]
NIST SP 800-63B-4 requires services that check passwords to store them in a form resistant to offline attacks, salted and hashed with a password hashing scheme that takes the password, a salt and a cost factor as inputs. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- [2]
The OWASP Password Storage Cheat Sheet says passwords should be hashed rather than encrypted or stored in plain text, because hashing is one-way while encryption is two-way and lets an attacker recover the original. reportedas of 2026-11-14
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Background, Hashing vs Encryption (retrieved 2026-11-14)
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Background, Hashing vs Encryption (retrieved 2026-11-14)
- [3]
NIST says the purpose of a password hashing scheme is to make each guess more expensive for an attacker who has stolen a file of hashed passwords, and that the cost factor should be as high as practical and raised over time as computers get faster. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- [4]
NIST explains that offline attacks become possible when an attacker steals hashed passwords in a database breach, and that because attackers can compute many billions of hashes per second offline, without rate limits, salting and slow hashing do not fully protect weak passwords. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Appendix A, Strength of Passwords (retrieved 2026-11-07)
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Appendix A, Strength of Passwords (retrieved 2026-11-07)
- [5]
NIST's Secure Hash Standard specifies hash algorithms that produce message digests, which are used to detect whether a message has been changed since the digest was generated. confirmedas of 2015-08-04
- FIPS 180-4: Secure Hash Standard (SHS) · NIST Computer Security Resource Center · Primary source · 2015-08-04 · Abstract (retrieved 2026-11-07)
- [6]
NIST requires each password's salt to be at least 32 bits long and chosen so that different accounts do not end up with the same hash, with the salt and hash stored together and a record of the hashing scheme and cost factor kept to allow later migration. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- [7]
OWASP says a unique salt per password defeats precomputed lookup tables such as rainbow tables, and means two users with the same password get different hashes. reportedas of 2026-11-14
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Introduction (retrieved 2026-11-14)
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Salting (retrieved 2026-11-14)
- [8]
The PKCS 5 standard (RFC 8018) explains that a salt combines with a password to produce a key, selecting one from a large set of keys derived from that password, and that the salt need not be kept secret. confirmedas of 2017-01-01
- RFC 8018: PKCS #5: Password-Based Cryptography Specification Version 2.1 · IETF / RFC Editor · Primary source · 2017-01-01 · Section 4, Salt and Iteration Count (retrieved 2026-11-14)
- [9]
OWASP recommends Argon2id with at least 19 MiB of memory, 2 iterations and 1 degree of parallelism; scrypt if Argon2id is unavailable; bcrypt with a work factor of 10 or more for legacy systems; and PBKDF2 with 600,000 or more iterations of HMAC-SHA-256 where FIPS-140 compliance is required. reportedas of 2026-11-14
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Introduction (retrieved 2026-11-14)
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Introduction (retrieved 2026-11-14)
- [10]
Argon2 won the 2015 Password Hashing Competition, and RFC 9106 (2021) describes it as a memory-hard function for password hashing. reportedas of 2021-09-01
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Password Hashing Algorithms, Argon2id (retrieved 2026-11-14)
- RFC 9106: Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications · IRTF / RFC Editor · Primary source · 2021-09-01 · Abstract (retrieved 2026-11-14)
- [11]
NIST recommends an extra keyed hashing or encryption step using a secret key known only to the service, stored separately from the hashed passwords and preferably inside hardware. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- [12]
OWASP describes a pepper as a secret shared by all stored passwords, unlike a per-password salt, that should be kept separately from the password database, for example in a secrets vault or hardware security module. reportedas of 2026-11-14
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Peppering (retrieved 2026-11-14)
- Password Storage Cheat Sheet · OWASP Cheat Sheet Series · Secondary source · Peppering (retrieved 2026-11-14)
- [13]
NIST requires services to limit consecutive failed sign-in attempts on a single account to no more than 100 for a given authenticator. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.2.2, Rate Limiting (Throttling) (retrieved 2026-11-07)
- [14]
NIST requires services to check a new or changed password against a blocklist of commonly used, expected or compromised passwords and to make the user choose another if it matches. confirmedas of 2025-07-01
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 · Sec. 3.1.1.2, Password Verifiers (retrieved 2026-11-07)
- [15]
NIST SP 800-63B-4 requires single-factor passwords to be at least 15 characters, bars composition rules such as mixing character types, and bars forcing periodic password changes. confirmedas of 2026-11-07
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 (retrieved 2026-11-07)
- NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management · NIST · Primary source · 2025-07-01 (retrieved 2026-11-07)
Revision history (1)
- Page created.
Created Nov 14, 2026. Last reviewed by an editor on Nov 14, 2026. Next scheduled review: Aug 14, 2027.
Cite this page
"How websites store passwords: hashing, salts and peppers." ContentLora, updated Nov 14, 2026. https://contentlora.com/explain/how-passwords-are-stored
Spotted an error? Suggest a correction or emailcorrections@contentlora.com.