DNS resolves domain names to IP addresses so people do not have to remember a series of numbers (IP addresses) when trying to visit a website. In order the speed up this process and reduce the traffic on the DNS servers, most computer operating systems will store or cache DNS lookups on your computer locally. At times, you may need to clear the cache to see changes.
In this tutorial, we’ll show you how to clear the DNS cache for the major operating systems on the market. Typically, this process is referred to as clearing or flushing the local DNS cache.
Flushing Local DNS Cache in Windows
Open the command line window, and depending on your version of Windows, this can be done in one of the following ways:
- Windows 11:
- Click the search box on the taskbar
- Type PowerShell in the search box
- Click the Windows PowerShell app to open it
- Windows 10:
- Click on the Start Menu
- Type cmd in the search box
- Click the Command Prompt app to open it
- Windows 7 and Vista:
- Click on the Start Menu
- Type cmd in the search box
- Right-click on cmd in the program search results and choose Run as Administrator.
- Windows 98/NT/2000/XP
- Click on the Start Menu
- Select Run
- Type or select cmd to open the command line window
Once the command line window is open type the following command at the prompt and hit enter.
After the flushdns is completed, type exit to close the command line window.
Flushing Local DNS Cache in Mac OS
OS X 10.7 and above
OS X 10.6 and below
To easily clear the cache on an iOS device, turn on Airplane Mode for 5-10 seconds and turn it back off by going to Settings > Airplane Mode. Alternatively, you can reboot your phone.
Flushing Local DNS Cache in Linux
Flushing the local DNS cache on Linux depends on which service handles your DNS caching. Typical services include systemd-resolved, nscd, dnsmasq, or BIND. Below are the typical methods for each:
To clear the cache on an Android device, open Chrome, tap the three vertical dots at the top-right corner, choose History, and then tap Clear browsing data.
1. systemd-resolved (Ubuntu 18.04+, many modern distributions)
If your system uses systemd-resolved, you can flush the DNS cache with:
sudo systemd-resolve --flush-caches
To confirm that your system is using systemd-resolved
, check:
systemctl is-active systemd-resolved
and/or verify that /etc/resolv.conf
is managed by systemd-resolved
.
2. nscd (Name Service Cache Daemon)
If you have nscd (Name Service Cache Daemon) installed:
sudo systemctl restart nscd
or on older (SysVinit) systems:
sudo service nscd restart
If nscd
is not installed, you can typically install it on Debian/Ubuntu with:
sudo apt-get install nscd
and on Fedora/CentOS/RHEL with:
3. dnsmasq
If you are running dnsmasq as a local DNS server/cache, restart it:
sudo systemctl restart dnsmasq
or on older systems:
sudo service dnsmasq restart
4. BIND
If you’re using BIND as a caching DNS server, you can clear the cache by running:
If you want to flush only specific domain entries, you can use:
sudo rndc flushname example.com
5. NetworkManager (alternative approach)
Some Linux distributions (notably Ubuntu or Fedora) will also leverage NetworkManager for DNS settings. You can try:
sudo systemctl restart NetworkManager
This doesn’t directly flush a DNS cache if you don’t have a dedicated caching service running, but it may reset DNS-related states.
Checking Which Method Applies
Check if systemd-resolved is active
systemctl is-active systemd-resolved
Check if nscd is running:
Check if dnsmasq is active:
Pick the flush method based on which service is actually in use.
Trust your business to an industry leader in fast and reliable website hosting solutions. InMotion Hosting offers secure
web hosting with 99.99% uptime, 24/7 expert human support, and 100% money-back guarantee.