WordPress salt generator

Make a fresh set of security keys and salts for your WordPress wp-config.php file.

This free WordPress secret key generator works in your browser. All inputs and calculations run locally on your device without server uploads; details on browser processing and storage are set out in the privacy policy.

What the keys do

WordPress uses these eight values to sign and encrypt the login cookies in your visitors’ browsers. Long random keys make the cookies impossible to forge. Changing them logs everyone out at once, which is a quick way to end every session after a suspected break-in.

How to use them

  1. Open wp-config.php in your site’s root folder.
  2. Find the block of lines starting define( 'AUTH_KEY'.
  3. Replace all eight lines with the ones above and save. Everyone, including you, will need to log in again.

Worked example: Replacing all 8 authentication keys and salts in wp-config.php

WordPress uses four cryptographic keys and four matching salts (8 constants in total, each 64 random printable ASCII characters drawn from a pool of 92 characters, giving ~417 bits of entropy per line) to sign login cookies (wordpress_logged_in_*, wordpress_sec_*) and CSRF nonces (_wpnonce). A generated block looks like this:

define('AUTH_KEY',         'k9#mP2$vL8@qR4!zX7&wN1*bC5^tY3(uI6)oP0-aS2+dF4=gH8~jK1|lZ9?mX2#c');
define('SECURE_AUTH_KEY',  'v4$nM7!qW2#eR9@tY1&uI5*oP8^aS3(dF6)gH0-jK4+lZ7=xC2~vB5|nM8?qW1#e');
...
define('NONCE_SALT',       'p0-aS2+dF4=gH8~jK1|lZ9?mX2#ck9#mP2$vL8@qR4!zX7&wN1*bC5^tY3(uI6)o');

Open your server's wp-config.php file via SFTP or SSH, locate the existing section between /*#@+ and /*#@-*/, replace all 8 define(...) lines with the newly generated block, and save the file.

Limits and what this tool cannot do

  • Does not change user passwords in the wp_users database table: Rotating wp-config.php salts invalidates all active browser login cookies and forces every administrator and user to sign in again, which kicks out anyone holding a stolen session cookie—but if an attacker knows a user's actual password, you must also reset that user's password in WordPress!
  • Single quotes, backslashes, and $ are excluded from the character pool: Because the constants sit inside PHP single-quoted strings ('...'), this generator intentionally excludes ', ", and \ so a generated character never breaks your wp-config.php PHP syntax.

Questions

Is it safe to generate keys on a website?

These keys are made by your own browser with its cryptographic random generator and are never sent anywhere.

How often should I change them?

After any security incident, when someone with server access leaves, or every few months if you like.

Will changing them break my site?

No. Logged-in users are signed out; nothing else changes.

Why should I generate WordPress salts locally in my browser instead of fetching api.wordpress.org/secret-key/1.1/salt/?

Generating the 8 keys locally via window.crypto.getRandomValues() means your site's secret cookie-signing keys are created inside your own computer's memory and never travel across the internet or pass through an external server.

What happens to logged-in users the moment I save the new salts in wp-config.php?

Every logged-in user (including you in wp-admin) is immediately logged out on their next page load because their existing wordpress_logged_in_ HMAC cookie signature no longer matches the new keys. They simply log back in with their username and password.

When is it mandatory to rotate WordPress keys and salts?

Rotate them immediately after migrating a site from a shared staging server, after revoking a contractor's FTP/SSH access, or whenever you suspect an admin session cookie or wp-config.php backup was exposed.

Last reviewed .

Related converters and guides