How to Flush the DNS Resolver Cache on Windows, macOS, and Linux
Flushing the DNS resolver cache can help solve internet connectivity issues and ensure that your system uses the most up-to-date DNS information. This article provides step-by-step instructions for clearing the DNS cache on Windows 11/10, macOS, and Linux.
For Windows 11/10 Users
Open Command Prompt
- Press
Windows + S
to open the search bar. - Type
cmd
orCommand Prompt
. - Right-click on
Command Prompt
and selectRun as administrator
.
- Press
Flush the DNS Cache
- In the Command Prompt window, type
ipconfig /flushdns
and pressEnter
: - You should see a confirmation message stating that the DNS Resolver Cache was successfully flushed:
- In the Command Prompt window, type
For macOS Users
Open Terminal
- Open
Spotlight
by pressingCommand + Space
. - Type
Terminal
and pressEnter
, or you can find the Terminal application in theUtilities
folder withinApplications
.
- Open
Flush the DNS Cache
Depending on your version of macOS, enter the appropriate command below and press
Enter
. You may need to enter your administrator password to execute the command.- For macOS 10.11 (El Capitan) and later:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- For macOS 10.10 (Yosemite):
sudo killall -HUP mDNSResponder
- For macOS 10.9 (Mavericks), 10.8 (Mountain Lion), and 10.7 (Lion):
sudo dscacheutil –flushcache
- For macOS 10.6 (Snow Leopard):
sudo lookupd –flushcache
- For macOS 10.11 (El Capitan) and later:
For Linux Users
Flushing the DNS cache on Linux depends on the DNS service used, such as nscd
, dnsmasq
, or systemd-resolved
.
For systemd-resolved
(common in newer distributions):
- Open a terminal window.
- Enter the following command:
sudo systemd-resolve --flush-caches
For nscd
:
- Open a terminal window.
- Enter the following command:
sudo systemctl restart nscd
For dnsmasq
:
- Open a terminal window.
- Enter the following command:
sudo systemctl restart dnsmasq
Conclusion
Flushing your DNS cache is a straightforward process that can resolve many common internet connectivity issues. If you continue to experience problems after flushing your DNS cache, consider checking your internet connection or contacting your ISP for further assistance.