The DNS cache is like your computer’s address book for the internet. It stores the mapping between domain names (such as example.com) and their corresponding IP addresses, allowing websites to load faster on subsequent visits.
However, when these saved entries become outdated or corrupted, you may encounter problems; sites may fail to load, redirect to the wrong server, or even pose security risks if malicious records are introduced.
Flushing the DNS cache clears these records, forcing your system to fetch fresh, accurate data. Some people call this a DNS reset, but it’s the same process. In this guide, you’ll learn why flushing DNS matters, the benefits it provides, and step-by-step instructions for clearing the cache on Windows, macOS, and Linux.
TL; DR:
Flushing your DNS cache clears outdated or corrupted records that can cause browsing errors, slow connections, or security risks. It forces your computer to fetch fresh DNS data, restoring accurate website access and improving speed.
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
Press Ctrl + Alt + T
Or search for Terminal in your applications menu
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
- (Verify with:
systemd-resolve --statistics, the “Current Cache Size” should reset to 0.)
Systems using nscd (Name Service Caching Daemon)
sudo systemctl restart nscd
- Systems using dnsmasq
sudo systemctl restart dnsmasq
- Systems using BIND (Berkeley Internet Name Domain)
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.
Conclusion
Your computer’s DNS cache works quietly in the background until it doesn’t, turning a helpful speed boost into a frustrating roadblock. The good news is that these issues are both common and easily fixable with a single command. By flushing the cache, you clear outdated or corrupted entries, which restores accurate connections, speeds up updates, and even adds an extra layer of security.
The process is completely safe and reversible. Your system will rebuild the cache automatically as you browse, so there’s no risk of losing important data. Think of it as a quick, definitive troubleshooting step: it either solves the problem or rules it out entirely.
For convenience, consider bookmarking this guide. The next time websites refuse to load or behave strangely, you’ll have the steps ready to refresh your DNS cache on Windows, macOS, or Linux in seconds, keeping your internet experience smooth, secure, and reliable.
Frequently Asked Questions
What is the difference between macOS and Mac OS X version names?
Apple shifted from the older Mac OS X version naming to macOS for modern apple devices like mac computers, the iphone, and the ipad. Each release has a codename (e.g., Mountain Lion, macOS Tahoe) and often brings new features, better security, and wider support for apps, games, and developers.
How do I use the Command Prompt or Terminal Window on different operating systems?
On Windows, the Command Prompt is where you type a command and then press enter to see a message. On mac models, you use a terminal window instead, accessible from the menu bar or the desktop. Linux, supported by the Linux Foundation and its community, also relies heavily on the terminal for management, control, and running code.
Are older Mac models and previous versions still compatible with DNS commands?
Yes, many mac models running previous versions of Mac OS can still use DNS commands. For example, on Mountain Lion, you would type sudo discoveryutil mdnsflushcache os as the corresponding command to flush DNS. Not all commands remain identical across modified versions, so always check compatibility notes for your operating system.
Why do developers and the general public care about operating systems like macOS and Linux?
Both mac and linux os options are used by developers to create files, build apps, and design games, but they also serve the general public for browsing browser windows, watching videos, making calls, or previewing a course. Thanks to strong project communities, languages support, and active api development, these platforms stay secure, reliable, and friendly for both apple silicon hardware and other apple or microsoft environments.
Yetunde Salami is a seasoned technical writer with expertise in the hosting industry. With 8 years of experience in the field, she has a deep understanding of complex technical concepts and the ability to communicate them clearly and concisely to a wide range of audiences. At Verpex Hosting, she is responsible for writing blog posts, knowledgebase articles, and other resources that help customers understand and use the company's products and services. When she is not writing, Yetunde is an avid reader of romance novels and enjoys fine dining.
View all posts by Yetunde Salami