When to Flush DNS Cache
You don’t need to clear your DNS cache every day, but there are specific situations where it’s the right step:
After changing DNS servers: Switching to providers like Google DNS or Cloudflare requires flushing so your system stops using old resolver data.
After moving a website to a new host: Cached entries may still point to the old server until cleared, causing downtime or errors.
When some sites don’t load but others do: Outdated records often block certain domains while leaving others unaffected.
After suspected DNS hijacking or malware: Flushing removes any malicious or altered records, forcing your system to fetch safe, verified DNS data.
Why Flushing DNS Helps
Flushing your DNS cache isn’t just a routine step; it delivers clear performance, privacy, and security advantages. It also fixes a range of everyday browsing issues that come from outdated or corrupted records.
Core Benefits | Common Issues Fixed |
|---|
Improved Accuracy – Removes outdated records so your device always connects to the correct server. | Website Errors – Fixes “site not found” or wrong page loads by forcing fresh lookups. |
Enhanced Privacy – Clears cached browsing history, reducing snooping risks on shared/public devices. | Slow Loading – Speeds up sites slowed by a bloated or corrupted DNS cache. |
Faster Resolution – Eliminates corrupted or overloaded entries, leading to quicker page loads. | Incorrect Routing – Prevents traffic from being sent to old or incorrect servers after IP/hosting changes. |
Security Protection – Removes malicious or hijacked DNS entries that could redirect to unsafe sites. | Access Blockages – Clears outdated restrictions that prevent access to certain sites. |
Troubleshooting Aid – Helps rule out DNS issues when diagnosing connectivity problems. | Connection Drops – Replaces faulty records that cause unstable or inconsistent connections. |
Step-by-Step Guide to Flushing DNS Cache
Flushing the DNS cache is an important task for maintaining a smooth and secure browsing experience. This process ensures that your system retrieves up-to-date DNS information, preventing issues like incorrect website loading or slow connections. Understanding how to flush the DNS cache across different operating systems can help resolve these issues and improve your device's performance.
How to Flush DNS Cache on Windows
Flushing the DNS cache on Windows is quick and helps fix issues like sites not loading correctly or pointing to the wrong server.
Step 1: Open Command Prompt
Press Win + R, type cmd, and press Enter.
Or search for Command Prompt in the Start menu, then right-click and choose Run as administrator (required for this command).
Step 2: Run the Flush Command
In the Command Prompt window, type:
ipconfig /flushdns
and press Enter. This clears stored DNS records and forces Windows to fetch fresh information.
Step 3: Confirm Success
You should see:
Successfully flushed the DNS Resolver Cache.
This means your DNS cache is cleared, and your computer will now pull updated DNS data whenever you visit websites.
How to Flush DNS Cache on macOS
Just like Windows, macOS stores DNS information locally. If websites aren’t loading correctly, redirect to the wrong server, or display outdated content, flushing the DNS cache forces the system to retrieve fresh records. The exact command depends on your macOS version.
Step 1: Open Terminal
Go to Applications > Utilities > Terminal
Or press Command + Space, type Terminal, and hit Enter
Step 2: Run the Command
For most modern versions (Ventura, Monterey, Big Sur, Catalina, Mojave, High Sierra and later), enter:
sudo killall -HUP mDNSResponder
Step 3: Authenticate
Enter your administrator password when prompted. You won’t see a confirmation message, but the cache will be cleared. To confirm, try reloading a previously failing site, it should now fetch updated information.
Legacy Versions (10.12 and earlier)
If you’re running an older release, use the command that matches your version:
Sierra (10.12) → sudo killall -HUP mDNSResponder; say DNS cache flushed
El Capitan (10.11) → sudo killall -HUP mDNSResponder
Yosemite (10.10) → sudo discoveryutil mdnsflushcache
Mavericks (10.9) – Lion (10.7) → sudo killall -HUP mDNSResponder
Snow Leopard (10.6) → sudo dscacheutil -flushcache
How to Flush DNS Cache on Linux
Linux doesn’t have a single built-in DNS cache like Windows or macOS. Instead, caching depends on the service or distribution you’re using. The most common services are systemd-resolved, nscd, dnsmasq, and BIND.
Step 1: Open Terminal
Step 2: Identify Your DNS Service (Optional but Helpful)
If you’re not sure which service your system uses, run:
sudo lsof -i :53 -S
This shows which process is handling DNS on your machine.
Step 3: Flush the DNS Cache
Run the command that matches your setup:
Ubuntu/Debian with systemd-resolved (most modern distros)
sudo resolvectl flush-caches
Systems using nscd (Name Service Caching Daemon)
sudo systemctl restart nscd
sudo systemctl restart dnsmasq
sudo rndc flush
To verify that the DNS cache has been successfully flushed on Windows, you can use the Command Prompt to run the ipconfig /displaydns command, which should return no entries if the cache was cleared.
On macOS, you can open the Terminal and use the command sudo killall -HUP mDNSResponder, followed by checking the system's DNS cache by trying to access a website to see if fresh information is retrieved.
For Linux, use the systemd-resolve --status command or check with specific DNS services by running sudo systemctl restart nscd or sudo systemctl restart dnsmasq based on your system configuration, ensuring the cache is emptied and fresh data is being used.
Troubleshooting DNS Cache Issues
Flushing your DNS cache usually fixes most browsing problems, but if issues persist, try these steps in sequence:
1. Run with Admin/Root Permissions
Some flush commands fail without elevated rights. On Windows, open Command Prompt as Administrator. On macOS/Linux, prepend commands with sudo. Without proper permissions, the cache may not clear.
2. Clear Your Browser Cache
Browsers keep their own DNS and file caches that can override system changes. In Chrome, Edge, or Firefox, clear cookies and cached data under Settings → Privacy. This ensures the site reloads with fresh records instead of stale entries.
3. Restart Computer or Network Adapter
If the flush doesn’t take effect immediately, restart your computer. For a quicker alternative, disable and re-enable your network adapter through system settings. This forces the network stack to reload with updated DNS.
4. Test with Command-Line Tools
Use DNS utilities to confirm the flush worked:
Windows/macOS/Linux: nslookup example.com Linux/macOS: dig example.com
The returned IP should match the current server. If it doesn’t, the issue may lie beyond your local cache.
5. Check DNS Propagation Online
Sometimes domains take time to update worldwide. Use tools like WhatsMyDNS or MXToolbox to check how far DNS changes have spread. If only some regions show the update, the issue is propagation, not your local machine.
6. Switch DNS Servers
If problems continue, your DNS provider may be unreliable. Change your system or router settings to use a stable public DNS, such as:
Google DNS → 8.8.8.8 and 8.8.4.4 Cloudflare DNS → 1.1.1.1 and 1.0.0.1
This can resolve persistent resolution errors and improve reliability.
Additional Tips for Smarter DNS Cache Management
Schedule Regular Flushes: You don’t have to clear your DNS cache daily, but performing a flush every month or two helps prevent old or corrupted records from lingering. Treat it like routine maintenance to keep your browsing smooth and accurate.
Restart After Flushing: Once you’ve cleared the DNS cache, restart your browser or the entire system if possible. This ensures any old network connections are dropped and your device immediately starts using fresh DNS data.
Combine with DNS Server Changes: If you’ve switched to a new resolver such as Google DNS or Cloudflare, flushing the cache is essential. Without it, your system may still attempt to resolve websites using outdated information from the old server.
Verify With Command-Line Tools: After a flush, you can use tools like nslookup, dig, or ping to confirm that your system is fetching updated DNS records. This step is optional but useful if you’re troubleshooting connectivity problems.
Protect Privacy on Shared Devices: On shared or public computers, flushing the DNS cache doubles as a privacy measure. It removes cached records of websites you’ve visited, helping reduce exposure of your browsing habits to other users.