How to Flush DNS Cache On Windows, Linux, and Mac 2023- A Comprehensive Guide

The Domain Name System (DNS) plays a crucial role in accessing websites and other internet resources. It acts as the phonebook of the internet by translating domain names into IP addresses. Your device stores these DNS records in a cache for faster lookups. But sometimes the cached records may become outdated or incorrect, leading to DNS problems like not being able to access certain websites. Flushing the DNS cache forces your device to do a fresh lookup and retrieve the latest DNS records.

Flushing the DNS cache is one of the first troubleshooting steps when dealing with internet or DNS issues. A flushed cache ensures your DNS queries are directed to the current best-performing DNS server. It also eliminates any corrupted, hijacked, or poisoned DNS entries that may have been cached previously. Flushing DNS can often resolve common problems like websites not loading, accessing the wrong website, slow internet speeds, etc.

In this comprehensive guide, we will show you how to flush the DNS cache on the three most popular operating systems – Windows, Linux, and Mac.

Read More: Get Unlimited Free Fire Free Diamonds For Free

How to Flush DNS Cache on Windows

Windows stores DNS records in its DNS Client service cache. Here are the steps to flush DNS cache on all versions of Windows:

Using Command Prompt

  • Open the Command Prompt window. You can do this by typing cmd in the Start menu or Run dialog box.
  • Type ipconfig /flushdns and hit Enter. This will flush the DNS resolver cache in Windows.
  • You can also flush the cache of a specific network adapter instead of the whole system. Just use the /registerdns switch along with the adapter name like ipconfig /flushdns /registerdns "[adapter name]"
  • Restart any applications that were using the DNS cache like web browsers or VPN clients for the DNS flush to take effect.

Using PowerShell

  • Launch PowerShell on your system. You can launch it from the Start menu or press Windows + X and select Windows PowerShell from the menu.
  • Type Clear-DnsClientCache and press Enter to flush the DNS cache.
  • To flush the DNS cache of a specific adapter, use Clear-DnsClientCache -InterfaceIndex [index] where the index is the number of the interface like 12.
  • You can find the interface index number using Get-DnsClientCache.

Using GUI Tools

There are various GUI apps and tools that provide a button to flush the DNS cache:

  • Windows Network Reset – Head to Settings > Network & Internet > Status > Network Reset. The ‘Reset Now’ button resets the TCP/IP stack as well as flushes the DNS cache.
  • ipconfig.exe – Navigate to C:\Windows\System32 and launch ipconfig.exe. Click the ‘Flush DNS’ button. May need admin access.
  • Command prompt shortcut – Right-click on the Command prompt shortcut icon and select ‘Run as administrator’. Then click on the ‘Flush DNS’ button.

Using Registry Editor

You can manually clear the DNS cache by deleting the cached DNS entries stored in the registry.

  • Launch Registry Editor by typing regedit.exe in the Run dialog box.
  • Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
  • Right-click on the CacheHashTable parameter and select Delete to flush the DNS cache.
  • Restart the DNS Client service for this change to take effect.

From the Command Line at Boot

You can also flush the DNS cache right at Windows boot before any applications start using it.

  • Open Notepad and enter the command:


Copy code

ipconfig /flushdns
  • Save the file  flushdns.cmd on your Desktop.
  • Now press Windows + R, type, and click OK to open the Startup folder.
  • Copy the flushdns.cmd file into this folder.

Now every time your system boots, the DNS cache will be flushed automatically via the command in the batch file.

How to Flush DNS Cache on Linux

Linux stores DNS records in a systemd-resolved cache or traditional dnsmasq cache depending on your setup. Here are the common ways to flush DNS cache on Linux:

Using systemd-resolve Service

Most modern Linux distributions like Ubuntu, Debian, Fedora, etc use systemd-resolved as the local DNS stub resolver.

  • Flush the systemd-resolved cache with the command:


Copy code

sudo systemd-resolve --flush-caches
  • Restart the systemd-resolved service for the flushed cache to take effect:


Copy code

sudo systemctl restart systemd-resolved

Using dnsmasq Cache

On Linux systems using dnsmasq as the DNS caching service:

  • Flush the dnsmasq cache by restarting the dnsmasq service:


Copy code

sudo systemctl restart dnsmasq
  • Alternatively, kill the dnsmasq process like sudo killall -HUP dnsmasq. It will restart automatically which flushes the DNS cache.

Using NetworkManager

Many Linux GUI distributions come with NetworkManager for network connectivity.

  • Flush the DNS cache using NetworkManager commands:


Copy code

nmcli networking off
nmcli networking on
  • Restarting the NetworkManager service also flushes its DNS cache:


Copy code

sudo systemctl restart NetworkManager

Per Application Cache

Some applications like Firefox and Google Chrome have their DNS cache.

Flush their cache from the application itself or by deleting the cache files/folders from the file system:

  • Firefox – Preferences > Privacy & Security > Cookies and Site Data > Clear Data
  • Google Chrome – Settings > Privacy and Security > Clear browsing data
  • You can also delete the cache and data/dns folders inside ~/.mozilla/firefox/*.default and ~/.config/google-chrome/ respectively.

Thus flushing the system-wide DNS cache along with per-app caches helps resolve all DNS issues.

How to Flush DNS Cache on Mac

MacOS comes with multiple caching layers for improved DNS performance. Flushing each of these caches resolves different issues.

Using Terminal Commands

The easiest way is using simple terminal commands that flush DNS caches:

  • Flush all DNS caches using:


Copy code

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • Just flushing the DNS cache:


Copy code

sudo dscacheutil -flushcache
  • Only flush the Multicast DNS cache:


Copy code

sudo killall -HUP mDNSResponder
  • Restarting your Mac ensures all caches are flushed completely.

The above commands flush the DNS cache for all network interfaces.

Per Network Interface

To flush the DNS cache for only a specific adapter:

  • List network interfaces using networksetup -listallnetworkservices
  • Flush DNS cache of Wi-Fi with:


Copy code

sudo dscacheutil -flushcache -networkservice Wi-Fi

Substitute Wi-Fi with the name of your desired network service.

Using GUI Tools

Various apps provide a one-click button to flush the DNS cache:

  • DotClear – Open the app > Local DNS Cache > Flush DNS Cache
  • DNS Flusher – Launch the app and click the Flush Cache button
  • CleanMyMac – Launch CleanMyMac X > DNS Cache and click the Scan & Clean buttons
  • Browsers like Safari and Chrome also have options to clear the browser DNS cache from settings.

Thus flushing all relevant caches using suitable methods resolves DNS issues on Mac.

When Should You Flush DNS Cache?

Here are some common instances and problems where flushing the DNS cache can help resolve the issue:

  • Cannot access certain websites – Website keeps refusing to load or displays a server not found error. Flushing DNS resolves it.
  • Redirected to a different website – Trying to open a website redirects you somewhere else. Indicates a hijacked DNS entry. Flushing it helps get the correct IP address.
  • Using a new DNS server – When you switch to a new DNS server, flushing the cache directs your requests to the new DNS server instead of old cached entries.
  • Cannot access the internet – No internet access after changing network or router indicates corrupted cached DNS records. Flushing the cache fixes it.
  • Slow internet speeds – Very slow general internet speeds can be due to overloaded or far-away cached DNS servers. Flushing fixes it.
  • Suspicious malware/virus – Malware and viruses often change DNS servers to hijack traffic. Flushing the cache resolves it.
  • IP address changed for website – Website loads sporadically due to stale IP address in cache. Flushing DNS busts the old cache.
  • New domains not resolving – New domains do not open since the cache still has old records. Flushing ensures the lookup of the latest records.
  • Unreachable local devices – Local devices show unavailable due to incorrect DNS cache. Flushing the cache fixes this.
  • Incorrect search page results – DNS pointing to a spam or incorrect web page instead of the intended one. Flushing the cache rectifies it.
  • Using VPN service – DNS requests bypassing VPN tunnel due to DNS leak. Flushing DNS rectifies it.

Thus whenever you suspect a DNS issue, flushing the DNS cache should be your first troubleshooting step. It will resolve many DNS-related problems.

DNS Cache Explained

But why is flushing the DNS cache able to fix many internet and DNS issues in the first place?

To understand this, we need to first see what a DNS cache does:

  • Your system queries a recursive DNS resolver provided by your ISP or chosen manually.
  • The resolver queries root nameservers to find the Top Level Domain (TLD) nameserver and then queries the TLD nameserver to find the authoritative nameserver for the website domain.
  • The authoritative nameserver returns the IP address of the domain name to the resolver server.
  • The resolver caches the domain name to IP address mapping locally in its DNS cache.
  • Further queries for the same domain are answered directly from the resolver’s cache without going to the authoritative nameserver.
  • DNS records have a Time-To-Live (TTL) after which they expire and need re-resolution. Cache entries also get invalidated by flushing the cache.

The DNS cache avoids re-resolution of the same domains again and again making web browsing faster. But it also means that any issues with cached records persist until the cache is flushed.

That is why flushing the DNS resolver cache helps fix various DNS problems.

Tools to View DNS Cache Contents

Flushing the DNS cache clears all existing records. But what if you want to view the current cached DNS entries instead of blindly flushing them?

You can use these tools to display the records stored in DNS cache:


  • ipconfig /displaydns – Displays cached DNS entries on Windows along with TTL values.
  • Get-DnsClientCache on PowerShell – Lists DNS cache for troubleshooting.


  • systemd-resolve --status – Shows current DNS cache entries and statistics.
  • cat /etc/resolv.conf – Lists the configured DNS resolvers whose cache needs flushing.


  • dscacheutil -q host -a name – Queries DNS cache for a specific host to check the cached entry.
  • dscacheutil -q entry -s – Displays details of cache entry for a domain.
  • No single command exists to display all cache entries together on Mac.

This allows selectively checking problematic cached entries instead of clearing the entire cache.

Alternative Ways to Refresh DNS

While flushing the DNS cache provides a quick solution, there are also alternative ways to refresh the DNS cache and records:

  • Restarting – Restarting routers, devices or applications completely refreshes all caches and DNS lookups.
  • Renewing IP – Renewing the DHCP lease or changing IP flushes the DNS cache. ipconfig /renew on Windows.
  • Clearing other caches – Clearing browser cache, SSL state, cookies, etc also forces fresh DNS lookups.
  • Waiting for TTL expiry – Allowing DNS records to expire by their TTL forces re-resolution queries.
  • Using public DNS – Using public DNS like Google ( or Cloudflare ( bypasses ISP issues.
  • DNS spoofing – Spoofing DNS locally using a host file or software forces specific entries.
  • VPN – Routing traffic through a VPN service bypasses local DNS issues.
  • Problems with ISP – Changing ISP or uplink provider sidesteps DNS issues originating from them.

These provide alternative approaches to refresh DNS and bypass issues.

Frequently Asked Questions (FAQ)

1. Does Flushing DNS cache speed up the internet?

Ans: Yes, flushing the DNS cache can speed up overall internet speeds in some cases. When the cache has outdated DNS records pointing to far-away servers, it can slow down web browsing. Flushing it allows your DNS lookups to route your traffic to faster servers.

2. Is Flushing DNS Cache Safe?

Ans: Flushing DNS cache is completely safe and does not cause any issues. The only temporary effect is that DNS queries will take slightly longer for some time as the cache builds up again.

3. How Often Should I flush DNS?

Ans: There is no set rule on how frequently you need to flush the DNS cache. Unless you face specific issues, flushing it once every few months is sufficient in most cases. Flushing it weekly or daily can slow down browsing slightly till the cache rebuilds.

4. Does Rebooting Flush DNS?

Ans: Yes, restarting your computer or device flushes all DNS caches completely as part of the reboot process. For convenience, you can also flush it manually without rebooting.

5. Does IPConfig /renew flush DNS?

Ans: No ipconfig /renew only renews your IP address lease and does not flush the DNS cache in Windows. You need to use the /flushdns switch to flush the DNS cache.


Ans: This error indicates DNS failure and connectivity issues. Flushing your DNS cache after getting this error will generally fix it. It may also point to problems with your router, firewall, or antivirus software.

7. Can Flushing DNS Fix Slow Internet?

Ans: Yes, flushing DNS can resolve slow general internet speeds in some cases where the DNS cache has become corrupted or overloaded. It discards incorrect records and allows faster lookups.

8. Is There Any Risk in Flushing DNS Cache?

Ans: No, there is no risk involved in flushing the DNS cache on your system. The only effect is temporarily slower domain name resolution till the cache rebuilds. It does not impact anything else or cause data loss.

9. Does Flushing DNS Cache Increase Security?

Ans: Flushing DNS can increase security by removing any malicious cached entries that may have been injected to redirect traffic or monitor your browsing activity. It also forces new secure SSL connections.

10. What is a DNS Leak and How Can Flushing DNS Fix it?

Ans: A DNS leak occurs when DNS queries bypass a VPN tunnel and reveal your real IP address. Flushing your DNS cache after connecting to a VPN ensures all queries are routed through the VPN tunnel securely.


Maintaining a flawless DNS cache is crucial for fast and secure web browsing. A corrupt cache leads to various DNS problems that are often difficult to diagnose.

Flushing the DNS cache provides a simple and effective first step to resolve most internet and DNS-related issues. It discards any malicious or erroneous cached entries and fetches the latest DNS records. Understanding exactly how to flush the DNS cache on your Windows, Linux or Mac device gives you an easy troubleshooting technique to keep your internet working smoothly.

Combined with the knowledge of when and why to flush DNS along with ways to analyze cache contents, you can leverage the DNS cache flush process to quickly troubleshoot and fix any DNS headaches.

So next time you face inexplicable internet issues, flush that DNS cache before going down more complex troubleshooting avenues!

Leave a Comment