
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.
ipconfig /flushdnsAfter the flushdns is completed, type exit to close the command line window.
exitFlushing Local DNS Cache in Mac OS
OS X 10.7 and above
- Open a Terminal window from Applications > Utilities.
- Type
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
and press Return. - Close the terminal window.
OS X 10.6 and below
- Open a Terminal window
- Type this command and hit Return
sudo dscacheutil -flushcache
- Close the terminal window
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-cachesTo confirm that your system is using systemd-resolved, check:
systemctl is-active systemd-resolvedand/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 nscdor on older (SysVinit) systems:
sudo service nscd restartIf nscd is not installed, you can typically install it on Debian/Ubuntu with:
sudo apt-get install nscdand on Fedora/CentOS/RHEL with:
sudo yum install nscd3. dnsmasq
If you are running dnsmasq as a local DNS server/cache, restart it:
sudo systemctl restart dnsmasqor on older systems:
sudo service dnsmasq restart4. BIND
If you’re using BIND as a caching DNS server, you can clear the cache by running:
sudo rndc flushIf you want to flush only specific domain entries, you can use:
sudo rndc flushname example.com5. NetworkManager (alternative approach)
Some Linux distributions (notably Ubuntu or Fedora) will also leverage NetworkManager for DNS settings. You can try:
sudo systemctl restart NetworkManagerThis 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-resolvedCheck if nscd is running:
systemctl status nscdCheck if dnsmasq is active:
systemctl status dnsmasqPick the flush method based on which service is actually in use.