Troubleshooting website issues can be challenging, especially when you’re unsure where to begin. One common issue is a corrupt local DNS cache, which can prevent your computer from reaching specific websites or servers. In this guide, Smart Web Creative will show you how to clear or flush DNS cache locally on various operating systems.
Flush Local DNS Cache on Windows
Clearing your local DNS cache on Windows is straightforward using the Command Prompt or Windows PowerShell. Here’s how you can flush your DNS cache:
Step 1: Open an elevated command prompt from the Power Users menu by typing the shortcut Windows Key + x. Then, click on Windows PowerShell (Admin).
Step 2: Input the following command and press Enter:
ipconfig /flushdns
You should see the following confirmation message:
Successfully flushed the DNS Resolver Cache.
Flush Local DNS Cache on macOS
For macOS, flushing your DNS cache requires running a command in the terminal. The command varies depending on your macOS version. Follow these steps to flush your DNS cache:
Launch Terminal and enter the appropriate command for your OS version. You will also need to input your password for permission to run these commands.
Mac OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra, macOS 10.14 Mojave, and macOS 10.15 Catalina:
sudo killall -HUP mDNSResponder
OS X 10.10 Yosemite:
sudo discoveryutil udnsflushcaches
OS X 10.7 Lion, 10.8 Mountain Lion, and 10.9 Mavericks:
sudo killall -HUP mDNSResponder
OS X 10.6 Snow Leopard:
sudo dscacheutil -flushcache
Flush Local DNS Cache on Linux
Many current Linux distributions do not utilize a local DNS resolver cache like Windows and macOS. If you are unsure whether your Linux installation uses local DNS caching, check the documentation for your Linux distribution.
Using Name Service Caching Daemon (NSCD) on Linux:
If you have NSCD installed, you can flush your DNS cache with the following commands:
To clear the local DNS cache for the current user:
nscd -i hosts
To clear the local DNS cache for all users:
nscd -I hosts
Using systemd in Ubuntu-based Linux Distributions:
Ubuntu-based distributions using systemd-resolved for DNS caching can use the following command to flush the DNS cache. You will need to enter your password to complete the process.
sudo systemd-resolve --flush-caches
Other Ubuntu-based Options on Linux:
Some Ubuntu and Debian-derived distributions use this command to flush the DNS cache:
sudo service dns-clean restart
Other Options on Linux:
For Linux distributions that are not Ubuntu-based, you may use this command to flush your DNS cache:
sudo /etc/init.d/dns-clean start
Final Thoughts
Don’t let access issues to specific websites frustrate you. Knowing how to flush DNS cache locally is a quick and effective way to determine if the issue lies deeper. Use these tools to troubleshoot and resolve connectivity problems.