Book a call Free rebuild
Home/Glossary/Security/Security Keys and Salts

Security Keys and Salts

June 3, 2022 Updated November 16, 2026 2 min read

Security glossaryWordPress security keys and salts are random strings in wp-config.php that WordPress uses to sign and verify login cookies and nonces, so they cannot be forged.

When someone logs in to WordPress, the site gives their browser cookies that prove who they are on later requests. To stop anyone forging those cookies, WordPress signs them with a cryptographic hash built from secret values that only the server knows. Those secret values are the security keys and salts, eight long random strings defined in wp-config.php.

The eight constants

define( 'AUTH_KEY',         'long random string' );
define( 'SECURE_AUTH_KEY',  'long random string' );
define( 'LOGGED_IN_KEY',    'long random string' );
define( 'NONCE_KEY',        'long random string' );
define( 'AUTH_SALT',        'long random string' );
define( 'SECURE_AUTH_SALT', 'long random string' );
define( 'LOGGED_IN_SALT',   'long random string' );
define( 'NONCE_SALT',       'long random string' );

Each key is paired with a salt. The AUTH and SECURE_AUTH pairs protect the login cookies used on plain HTTP and HTTPS connections, LOGGED_IN protects the cookie that marks a visitor as logged in on the front end, and NONCE protects nonces, the short-lived tokens WordPress uses to defend forms and links against cross-site request forgery. Nonces are not passwords; they confirm that a request was meant to be made.

What they do not do

Security keys do not protect stored passwords. WordPress hashes user passwords separately, each with its own salt, so changing the keys has no effect on passwords. They also do not encrypt cookies: a WordPress login cookie contains the username and an expiry time in readable form, and the keys make the attached signature impossible to forge.

Setting and changing them

The installer normally fills them in. If they are missing or still say "put your unique phrase here", WordPress generates its own values and stores them in the database instead, which is weaker, because anyone who gets a copy of the database gets them too.

To set new ones, either:

Changing the keys invalidates every existing login cookie and nonce, so everyone, including you, is logged out, and any half-filled admin forms will need to be submitted again.

When to change them

  • After a hack or malware cleanup, so an attacker's stolen sessions stop working.
  • When someone with access to the server or wp-config.php leaves the team.
  • If wp-config.php has been exposed, for example committed to a public code repository.

Treat the keys like passwords: never share them, never reuse them between sites, and keep wp-config.php out of public repositories. For more background, see our article on WordPress salts.

Source: WordPress Developer Resources, wp-config.php: Security Keys.

WP Services

WordPress services at revolutionary pricing.

Productized WordPress services, from builds to care, delivered by Seahawk and tracked in one app. For the WordPress lovers.