
If you’re using WordPress, keeping your WordPress site safe from security threats should be a top priority. WordPress is a popular CMS, making it a frequent target for cyberattacks. If your security is compromised, you risk losing your data, website, and potential income.
A critical step in securing your WordPress website is ensuring your passwords are strong. WordPress salts and security keys can provide an added layer of protection by encrypting your login password, making it difficult for hackers to crack.
This guide explains WordPress salts and security keys, how they function, why you should consider changing them, and the steps to do so effectively.
KEY TAKEAWAYS
- WordPress salts are used with security keys to protect your login credentials by converting them into complex, unreadable strings using hashing.
- Salts work with security keys to protect cookies and sessions.
- You can find salts and keys in the wp-config.php file.
- Updating salt logs out all users, making stolen cookies useless to attackers.
- You can generate new salts using the WordPress Secret-Key Service.
- Regularly updating salts helps prevent security breaches and strengthens your WordPress site’s overall protection.
- Plugins like Salt Shaker can automate salt updates without manual file editing.
- Avoid sharing the wp-config.php file to keep your salts and other sensitive data secure.
- Combining strong passwords, two-factor authentication, and regular salt updates significantly reduces the risk of attacks.
TABLE OF CONTENTS
What Are WordPress Salts? How They Work
WordPress salts are random strings of characters that work with security keys to protect login data. When you log in to your WordPress website, cookies are created to store your authentication information. These cookies are vulnerable to attacks, especially if a hacker gains access to them.
Salts add an extra layer of security by making the data in these cookies unreadable. They turn your plain text passwords and other sensitive information into complex, encrypted strings. Without salts, hackers can easily reverse-engineer your login details. However, with salts, the data becomes harder to decode, even if someone manages to steal the cookies.
WordPress Salts vs Security Keys
Security keys are predefined constants that WordPress uses to secure login data. They act as encryption keys. However, salts are random strings added to these keys to obscure the encrypted data.
Together, keys and salts work to protect your WordPress site by ensuring that login data is hashed, encrypted, and difficult to reverse-engineer. This makes it much harder for anyone to decode your passwords and gain unauthorized access.
How WordPress Salt Keys Work
When you write your username and password to log in, WordPress doesn’t store the actual password. Instead, it uses salts and security keys to transform it into a hashed string.
Hashing is the technique of converting plain text data into a fixed-length string of characters. WordPress salts add random characters to your login data before hashing it. This ensures that even if two users have the same password, their hashed strings will look completely different.
For example, if your password is yourpassword, WordPress salts will convert it to a string like
SG^&%@KD>>:_+$#%HBJH6#jkj
This string is then stored in the WordPress database. Even if a hacker gets access to the database, they won’t be able to read the actual password because it’s been scrambled with a unique salt.
Now, what’s the role of cookies in login sessions?
When you log in to WordPress, cookies are created to keep you logged in. These cookies store sensitive data, such as your username and hashed password. Some common cookies include:
wordpress_[hash]: Stores your login authentication details
wordpress_logged_in_[hash]: Confirms that you’re logged in and who you are
Without salts, these cookies would contain easily readable data that hackers could use to hijack your session. But with WordPress salts, the data in these cookies becomes complex and nearly impossible to decode.
For example, instead of storing your username as admin, the cookie data may look like k12h9f8jsd3fj2s. This makes it much harder for attackers to decipher the data, even if they manage to steal the cookie information.
Hashing Process Explained
Hashing is critical to how salts work in WordPress. It converts plain text data into a string of characters using a specific algorithm.
Here’s how the process works:
- Input Data: When you log in, WordPress takes your password and combines it with a unique salt.
- Apply Hashing Algorithm: The combined data is run through a hashing algorithm, which scrambles it into a fixed-length string.
- Store Hashed Data: The resulting hashed string is stored in the database instead of the plain text password.
If a hacker tries to access the database, they’ll only see the hashed strings, not the actual passwords. And because each user’s session is hashed using different salts, even if two users share the same password, their hashed data will look completely different.
How to Locate WordPress Salts
WordPress salts are stored in the wp-config.php file. This file is one of the most important configuration files in your WordPress installation. It contains essential settings, including database credentials and authentication keys.

To access the wp-config.php file, you need to connect to your WordPress website using one of the following ways:
- File Transfer Protocol (FTP) Client (e.g., FileZilla)
- Hosted®’s File Manager
- File Manager Plugin
For this section example, we use the second method. To follow along, go through the following steps:
Login to the Hosted® cPanel and go to Files → File Manager.

Once opened, navigate to the public_html directory, which is the root directory of your WordPress installation. You’ll see the wp-config.php file. Right-click on it and choose Edit.

Inside the file, look for a section named Authentication unique keys and salts. Here, you’ll find 8 authentication keys and salts that WordPress uses to secure your login data. Each of these keys and salts has a specific role:
- AUTH_KEY: Secures cookies and verifies the authenticity of user sessions.
- SECURE_AUTH_KEY: Protects user sessions when using HTTPS.
- LOGGED_IN_KEY: Verifies that a user is logged in.
- NONCE_KEY: Secures nonces, which are temporary tokens used to validate requests.
- AUTH_SALT: Adds extra randomness to the AUTH_KEY.
- SECURE_AUTH_SALT: Adds randomness to the SECURE_AUTH_KEY.
- LOGGED_IN_SALT: Adds randomness to the LOGGED_IN_KEY.
- NONCE_SALT: Adds randomness to the NONCE_KEY.

Each of these keys and salts is a long, random string that WordPress uses to secure user sessions and cookies. If you ever need to regenerate these salts, you can use the WordPress secret-key generator (you will learn about this later in this guide). This generator creates new, unique keys and salts that you can copy and paste into the wp-config.php file.
Changing these salts will immediately log out all users, forcing them to log in again. This action helps to invalidate any existing sessions and secure your WordPress site against unauthorized access.
Hosted®’s WordPress Hosting is built with security at its core, offering advanced features like a free SSL Certificate, malware scanning, and real-time server protection to guard against cyber threats.
Backed by expert support, Hosted® ensures your website stays secure and ready for growth.
How to Change WordPress Salts
Changing WP salts is an important security measure that can prevent unauthorized access to your WordPress site. One way to do this is by manually updating the salts in the wp-config.php file. This method requires some technical steps, but it’s a straightforward process that can significantly improve your site’s security. You can also use a WordPress plugin for this purpose. Let’s learn both methods below:
Manual Update via wp-config.php
Before you update the salts, you need to generate new ones using the WordPress salt generator tool. It creates fresh keys and salts. Here’s how to get new salts:
Open a browser and go to the WordPress Secret-Key Service. The link to this service is also given in the wp-config.php file.

The page will display a set of 8 unique keys and salts, each on its specific line. Copy all the generated keys and salts and paste them into a TXT file.

Now that you have generated new salts, it’s time to access the wp-config.php file. Scroll down until you see the section called Authentication Unique Keys and Salts. Here, you’ll see the current keys and salts. Replace them with the new ones you just saved in a TXT file. Here’s how:
- Delete the existing keys and salts.
- Paste the newly generated keys and salts.
- Save the changes and close the file.

After saving the wp-config.php file, the new salts will take effect immediately. This action will log out all users, including you, and force them to log back in. This is a security measure to ensure that any existing sessions using old salts are invalidated.
Note: Before making any changes, create a backup of the file. This way, if something goes wrong, you can restore the original settings.
Use Plugins
If you’re not comfortable editing the wp-config.php file manually, you can use plugins to manage your WordPress salts. Plugins make it easy to update salts without using any code. Two popular plugins for managing salts are:
- Salt Shaker
- Sucuri Security
For this section example, we use Salt Shaker, because it’s a simple plugin that allows you to update your salts automatically. It’s a great option if you want to schedule regular salt updates without manually accessing your site’s files.
Here’s how to use it:
Go to Plugins → Add New in your WordPress dashboard. Find Salt Shaker, then click Install Now. After installation, click Activate to enable the plugin.

After that, navigate to Tools → Salt Shaker in the WordPress dashboard. Check Enable automatic salt key updates under Scheduled Salt Keys Change and set the update interval (e.g., daily, weekly, monthly).
If you’re using the premium version of this plugin, you can set a specific date and time as well. After that, click Save Changes to schedule automatic salt updates.

Alternatively, click Change Salt Keys Now to manually revise salt keys.

Why & When to Change WordPress Salts
WordPress salts play a crucial role in securing your site’s login data. Over time, these salts can become vulnerable, especially if a security breach occurs or if someone with access leaves your team. Regularly updating salts keeps your site secure and protects user information. Let’s look at when you should change WP salts and why it’s so important.
Here are some scenarios requiring salt updates:
After a Security Breach or Hack
If your WordPress site has been compromised, it’s crucial to change your salts immediately. Hackers may have accessed your cookies or login data, making it easier for them to gain unauthorized access. By updating the salts, you invalidate all existing sessions, forcing everyone to log in again.
When a User with Access Leaves the Organization
When a user who had access to your WordPress dashboard leaves, they could still have active sessions. Changing the salts will log them out and prevent them from reusing old cookies to access the site. This is a quick way to secure your site and limit access.
Periodically, as a Proactive Security Measure
Even when there hasn’t been a security incident, it’s a good practice to update your salts every few months. Regular updates keep potential attackers from using stale cookies or exploiting old session data. It’s a simple but effective way to maintain ongoing security.
Best Practices for Managing WordPress Salts
Managing WP salts is essential for keeping your site secure. Salts add extra protection to your login data, making it harder for hackers to decode sensitive information. To get the most out of WordPress salts, follow these best practices:
- Regularly update your WordPress salts. It’s a simple but powerful way to keep your site secure. By manually updating the salts, you ensure that old sessions are invalidated and potential security risks are minimized.
- The wp-config.php file has sensitive data. Never share it with others or leave it accessible to unauthorized users.
- Ensure you copy the new keys and salts accurately. Even a small error or mistake can break your site.
- Once you’ve updated the salts, log back in and test the site’s functionality to confirm everything is working correctly.
- Use strong and unique passwords to protect your site. For this, combine uppercase and lowercase letters, numbers, and symbols for stronger protection.
- Ask users to verify their identity using an additional method (e.g., a code sent to their phone). It adds another layer of security in case someone gains access to your login credentials.
- Install a security plugin that has a firewall to monitor and block malicious traffic.
- Maintain regular backups of your site to restore data fast in case of errors.
Following these best practices will help you keep your WordPress salts secure and effective. Regular updates, strong passwords, and additional security measures work together to protect your site from unauthorized access.
![WordPress Hosting that puts your website’s security first Strip Banner Text - WordPress Hosting that puts your website’s security first. [Get started]](https://www.hosted.com/articles/wp-content/uploads/2025/05/wordpress-salts-2-1024x229.webp)
FAQS
How often should I update my WordPress salts?
It’s recommended to update salts every few months or after a security breach. Regular updates log out all users and prevent attackers from using stolen session data.
What happens when I change WordPress salts?
Changing salts logs out all active users and invalidates existing cookies. This action prevents unauthorized users from continuing any existing sessions.
Are salts enough to secure my WordPress site?
While salts add an extra layer of protection, they work better with other security measures like strong passwords, two-factor authentication, and regular site monitoring.
Will changing salts affect my site’s functionality?
No, changing salts won’t affect your site’s functionality. However, it will log out all users, requiring them to log in again using fresh session data.
How do salts protect against brute-force attacks?
Salts encrypt login data using random strings, making it nearly impossible for cyber criminals to guess or reverse-engineer the hashed strings, even if they access your database.
Other Related Tutorials
– How To Remove Query Strings From Static Resources In WordPress
– WordPress Anchor Links: Easy Manual & Automatic Setup
– How To Troubleshoot & Fix Common WordPress Issues
– WordPress Pagination: How To Add It Manually Or With Plugins
– How to Create a WordPress Image Carousel X Easy Ways
