Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
A salt is a unique random value stored with each password hash; a pepper is a secret held outside the database. Together they decide how long a stolen password table survives.

What Are Salting and Peppering?
Two people on your platform choose the same weak password. Without a salt, their stored hashes are identical, and an attacker who cracks one has cracked both—and can spot every other account using that password at a glance. Salting and peppering are the two values that break this pattern, and the difference between them is where they live.
A salt is a random value generated separately for every password and stored alongside the hash. A pepper is a single secret value mixed into every password, held somewhere the database is not, such as an HSM, a key vault, or application configuration.
A salt does not make an individual password harder to guess. What it destroys is economy of scale:
Salts are not secret and do not need to be. They must be unique per password, generated by a cryptographically secure random source, and at least 16 bytes. Never reuse a site-wide salt, and never derive one from the username or email address, because attackers can rebuild those.
A pepper addresses a different scenario: the database is stolen but the application servers and key store are not. SQL injection, a misconfigured backup bucket, and a leaked read replica all produce exactly that outcome. Without the pepper the hashes cannot be attacked at all, because every guess is missing a secret input.
Two implementations are common. The simpler one applies an HMAC with the pepper as the key before passing the result into the password hash. The stronger one encrypts the finished hash with a key held in an HSM, so the secret never reaches application memory. Either way the pepper needs a rotation plan: version every pepper, store the version with the record, and re-wrap on next login.
Salt and pepper only matter on top of a deliberately slow algorithm. The current OWASP guidance is Argon2id as first choice, with scrypt, bcrypt, and PBKDF2 as fallbacks where a vetted Argon2 binding is unavailable.
| Algorithm | Suggested settings | Salt handling |
|---|---|---|
| Argon2id | 19 MiB memory, 2 iterations, 1 degree of parallelism | Generated and encoded automatically |
| bcrypt | Work factor 10 or above; passwords truncated at 72 bytes | 128-bit salt in the output string |
| PBKDF2-HMAC-SHA256 | 600,000 iterations | Supplied by the caller—do not skip it |
Raise the cost parameters as hardware improves, and re-hash on successful login when the stored parameters are below your current standard.
Article 32 of the UK GDPR requires security measures appropriate to the risk, and the ICO’s guidance on passwords in online services is specific: hash with a unique salt per password and use a slow, purpose-built algorithm. Where a breach notification shows passwords were stored in plaintext or with a fast unsalted hash, the ICO treats that as a failure of technical measures rather than bad luck. Cyber Essentials and PCI DSS requirement 8.3.1 point in the same direction.
At Privia Security, we check password storage as part of our Web Application Security Services, including the legacy code paths that quietly undo a good implementation.
No. A salt is stored in plain sight next to the hash, usually inside the same encoded string, and the scheme is designed to remain safe when the attacker has it. Its job is uniqueness, not secrecy. If you want a secret component, add a pepper and keep that outside the database, because trying to hide salts gives no extra protection and complicates verification.
Yes, and you do not need the original passwords. Apply the pepper to each stored hash, for example by encrypting it with a key in your key vault, and record which records have been converted. New and changed passwords then go through the full chain. Keep a version field so you can rotate the pepper later without another migration.
At least 16 bytes from a cryptographically secure random generator, which is what Argon2id and bcrypt produce by default. Shorter salts start to collide once you have millions of accounts, which partially restores the attacker’s ability to batch work. There is no practical reason to go below 16 bytes, and nothing is gained by exceeding 32.
Every password hash protected by it becomes unverifiable, and all users must reset their passwords. That makes pepper key management a genuine availability risk, so treat the value like any other critical key: store it in an HSM or managed key service, back it up under separate control, document the recovery path, and test that path before you rely on it.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.