Skip to content
Launch offer 50% off your first year of Keel Pro. See prices →

WordPress salts and security keys: what they are and when to change them

Eight lines in wp-config.php decide whether a stolen login cookie keeps working. What the keys do, why changing them logs everyone out, and when you should.

Keel team · · 3 minutes read

Open wp-config.php on any WordPress site and you find eight lines of random-looking text: AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY and four matching SALT lines. Most site owners never touch them. They are one of the most useful tools you have after a security problem.

What the keys do

When you log in, WordPress gives your browser a cookie that says who you are. To stop anyone from simply writing their own cookie, WordPress signs it using these secret keys. On every request, it checks the signature. A cookie signed with the right keys is accepted; anything else is not.

The keys are also used for nonces, the short tokens that protect forms and admin actions against being triggered from another site.

Why changing them logs everyone out

If you replace the keys, every existing login cookie was signed with the old ones, so none of them are valid any more. Everyone, including you, has to log in again. That sounds like a nuisance; it is exactly the point.

Changing a password does not end existing sessions everywhere. Changing the keys does, for every account at once.

When to change them

  • After a break-in, or when you suspect one. Attackers often keep a stolen login cookie even after the password changes.
  • When someone with administrator access leaves: a developer, an agency, a former employee.
  • When a laptop or phone that was logged in is lost or stolen.
  • If the keys were never set, or still contain the placeholder text from the sample config file.
  • If wp-config.php was ever exposed, for example through a backup file left in a public folder.

There is no need to change them on a schedule. Change them when there is a reason.

How to change them

By hand

  1. Generate a fresh set. Our free security keys generator makes them in your browser, without sending them anywhere.
  2. Open wp-config.php with your host’s file manager or SFTP.
  3. Replace the eight existing lines with the new ones. Keep the rest of the file as it is.
  4. Save. You will be logged out; log in again.

In one click with Keel

In Keel › Hardening › Security tools, press Change the salts. Keel makes a database backup first, writes new keys to wp-config.php, and everyone logs in again. This is in the free version. The file must be writable; the screen tells you if it is not.

Things to know

  • Two-factor backup codes need to be made again afterwards in Keel.
  • Some hosts and plugins store keys outside wp-config.php (for example as environment variables). If the lines are missing from the file, check with your host before adding them.
  • Never share the keys, paste them into a support chat, or commit them to a public repository.

Keys after a hack: the full list

Changing the keys is one step of a clean-up, not the whole thing. After a break-in, also change every password (WordPress, hosting, database, SFTP), remove the malware, update everything, and look for administrators you did not create. See Is my WordPress site hacked?.

Common questions

Will changing the keys break my site?

No. The only effect is that everyone is logged out and has to log in again.

Do I need to change the keys on every site?

Each site should have its own keys. Never copy the same set to several sites.

Do the keys protect passwords?

No. Passwords are stored as hashes in the database; the keys sign cookies and form tokens.

Keel does this for you.

Speed, security and SEO in one WordPress plugin, with plain-language settings. Free on any number of sites.

Get Keel free

Five minutes from now

Give your site a keel.

Steady when traffic spikes, calm when attacks come, found when people search. Start free; go Pro when a site needs more.