WordPress Salt Generator (Secret Keys for wp-config.php)

This generator creates all eight WordPress security keys and salts in one block, ready to paste into wp-config.php. Press Copy, replace the eight matching define() lines in your file, and save. The keys are built in your browser with the Web Crypto API and never sent to a server. If you need the whole file rather than just the keys, our wp-config.php generator builds a hardened one around them.

Generated in your browser with the Web Crypto API. Nothing is sent to our servers.

	
Key Takeaways
  • WordPress uses eight secret keys and salts in wp-config.php to sign login cookies and nonces.
  • Copy the block from the tool above and replace the matching eight define() lines, or run wp config shuffle-salts.
  • Changing them logs every user out. Passwords, application passwords and content are not touched.
  • They are not password salts. WordPress hashes each password separately with bcrypt, which has its own per-password salt.
  • There is no need to rotate keys on a schedule. Change them after a breach, a staff change or a site handover.

What are WordPress salts and security keys?

WordPress salts and security keys are eight long random strings, defined as constants in wp-config.php, that WordPress mixes into the signatures on login cookies and nonces. Because an attacker does not know them, they cannot forge a valid login cookie or a valid nonce even if they know how WordPress builds one.

Four are called keys and four are called salts. In practice WordPress joins each key to its matching salt and uses the pair as one secret, so the naming matters less than the fact that all eight are long, random and unique to your site. They are set once at install and you never type them in. You only touch them again to force everyone to sign back in or after a suspected compromise.

The eight keys and salts

ConstantsWhat they sign
AUTH_KEY, AUTH_SALTThe admin auth cookie on sites that are not forced to HTTPS
SECURE_AUTH_KEY, SECURE_AUTH_SALTThe secure auth cookie, used when the admin runs over HTTPS
LOGGED_IN_KEY, LOGGED_IN_SALTThe logged-in cookie that tells the front end who you are
NONCE_KEY, NONCE_SALTNonces, the short tokens that protect forms, AJAX calls and action links
Each pair is combined by wp_salt() in wp-includes/pluggable.php and used by wp_hash().

Are WordPress salts the same as password salting?

No, and this is the most common mix-up. In general security, salting means adding a unique random value to each password before it is hashed, so two users with the same password end up with different hashes and precomputed lookup tables are useless.

WordPress does salt passwords that way, but not with these constants. Since WordPress 6.8, wp_hash_password() hashes passwords with bcrypt through PHP’s password_hash(), which generates a fresh salt for every password and stores it inside the hash. The eight constants in wp-config.php are site-wide secrets for HMAC signatures on cookies and nonces. That is why changing them logs people out but never changes or breaks anyone’s password.

Where do the salts go in wp-config.php?

Open wp-config.php in the root of your WordPress install and find the block under the comment “Authentication unique keys and salts.” On a fresh manual install it looks like this:

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

Replace all eight lines with the block from the generator, keep the semicolons, and save. Do not leave any line on the placeholder. For a full tour of the file, see our guide to wp-config.php.

How to change your WordPress salts

  1. Back up your current wp-config.php so you can revert if anything goes wrong.
  2. Generate a new set with the tool above and press Copy.
  3. Open wp-config.php over SFTP or your host’s file manager.
  4. Select the existing eight key and salt lines, paste the new block over them, and save.
  5. Log back in. Everyone else will have to do the same.

Change them with WP-CLI instead

If you have shell access, WP-CLI can do the swap in place without opening the file:

wp config shuffle-salts

It rewrites the standard key and salt constants in wp-config.php with new values. You can pass specific constant names to shuffle only some of them. Our WP-CLI commands guide covers getting set up.

What changes when you regenerate the keys

Here is what a new set of salts does and does not affect, traced through the WordPress core source rather than assumed:

ThingAffected?Why
Login sessionsYes, everyone is logged outAuth cookies are signed with wp_hash(), which uses the salts. Old cookies no longer validate.
Open forms and action linksYes, until the page is reloadedNonces are built from wp_hash(..., 'nonce'). A stale one shows “The link you followed has expired.”
User passwordsNoPasswords are hashed with bcrypt and their own per-password salt, not the wp-config constants.
Application passwordsNoSince 6.8 they are hashed with wp_fast_hash(), which does not use the salts.
Posts, settings, pluginsNoNothing in the database is re-encrypted or rewritten.
Checked against wp-includes/pluggable.php and wp-includes/functions.php in current WordPress core, November 2026.

One practical note: some plugins encrypt stored data with a key derived from your salts. Google’s Site Kit, for example, uses LOGGED_IN_KEY and LOGGED_IN_SALT to encrypt its saved credentials, so after a change it may ask you to reconnect. If a plugin suddenly cannot read its API keys or tokens, re-enter them in its settings.

When should you regenerate your keys?

  • After a security incident, or any time you think a session cookie may have leaked. New salts invalidate stolen cookies instantly.
  • When you want to force every user to log out at once, for example after removing a staff account.
  • After buying or inheriting a site, so old sessions from the previous owner stop working.
  • If your install has blank, duplicated or placeholder values.

There is no need to rotate them on a fixed schedule. Strong, unique keys that you change when it matters are enough. If you are tightening things up after a scare, our guide to WordPress login security covers what else to change, and application passwords and passkeys are worth a look for how people sign in.

What if the salts are missing or still say “put your unique phrase here”?

WordPress will not stop working. wp_salt() treats a missing constant, the placeholder text, or a value used more than once as unusable. For each one it generates a random 64-character value with wp_generate_password() and saves it as a site option such as auth_key or nonce_salt.

That fallback is safe enough to keep a site running, but it moves the secrets into the database, so anyone who gets a database dump also gets them. Defining real values in wp-config.php keeps the secrets out of the database, which is why it is still worth doing.

Is this generator safe to use?

Yes. The values come from crypto.getRandomValues(), the browser’s cryptographically secure random number source. Each of the eight values is 64 characters drawn from 92 printable ASCII characters (single quotes and backslashes are left out so nothing can break the PHP string), which works out to about 417 bits of randomness per value. Nothing is sent to SmartWP or anyone else. Press Regenerate for a new set whenever you like.

OptionWhere the keys are madeBest for
This generatorIn your browserCopying a set into wp-config.php without the values crossing the network
api.wordpress.org secret-key serviceOn WordPress.org’s server, sent to you over HTTPSScripts and installers that fetch a set automatically
wp config shuffle-saltsOn your server, written straight into wp-config.phpAnyone with SSH and WP-CLI
All three produce eight define() lines in the format WordPress expects.

All three are fine choices. The tool on this page is one of several free SmartWP tools, none of which ask for an email address.

Frequently asked questions

Will changing my salts break my site?

No. It logs users out and expires any open forms, but content, settings and plugins are untouched. The one real risk is a typo in wp-config.php, such as a missing quote or semicolon, which causes a PHP error. Back the file up first and paste the whole block cleanly.

Do the keys and salts need to be exactly 64 characters?

No exact length is required, but they should be long and random. WordPress generates 64-character values itself when it has to fall back, and this generator uses the same length.

Is this the same as the official WordPress salt generator?

It produces the same output format as the api.wordpress.org secret-key service: eight define() lines you can paste straight in. The difference is where the randomness comes from. The official service generates the keys on its server, while this one creates them in your browser.

Does changing WordPress salts change user passwords?

No. Users keep their existing passwords and simply log in again. Password hashes do not depend on the wp-config salts.

How often should I change them?

Only when you have a reason, such as a suspected breach, a staff change or a site handover. Routine rotation on a timer is not necessary for most sites.

Picture of Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 15 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way. Found this article helpful? Buy Me A Coffee

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly
Get the latest from SmartWP to your inbox.