How to flush DNS cache?

Your computer keeps a local DNS cache to avoid repeating the same lookups. It stores the mapping between domain names and IP addresses so the next visit is faster. Most of the time that works fine, but it can cause headaches: a site you just migrated to a new host still shows the old version, a page refuses to load while it works perfectly on your phone, or you get a persistent DNS error after changing your network settings. Flushing the DNS cache clears all of that out and forces your system to start fresh.

Flushing DNS cache on Windows

The process is the same on Windows 10 and Windows 11. Open Command Prompt as administrator: press the Windows key, type "cmd", right-click on "Command Prompt" and select "Run as administrator".

Then type the following command and press Enter:

ipconfig /flushdns

You should see the message "Successfully flushed the DNS Resolver Cache." If you get an error instead, make sure you opened the Command Prompt with administrator rights.

Before flushing, you can check what is currently in the cache with:

ipconfig /displaydns

Run that same command after the flush to confirm it worked. The list should be empty or nearly so.

Flushing DNS cache on Mac

On macOS, the exact command depends on your system version. Open Terminal (Applications, Utilities, Terminal) and use the command for your version:

macOS Ventura, Sonoma, Sequoia (macOS 13 and later):

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

macOS Monterey and Big Sur (macOS 11 and 12):

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

macOS Catalina and Mojave (macOS 10.15 and 10.14):

sudo killall -HUP mDNSResponder

Your admin password will be required for all of these. Terminal will not display a confirmation message if the command succeeds. No output means it worked.

Flushing DNS cache in your browser

Here is something most guides leave out: modern browsers keep their own DNS cache, separate from the operating system. Flushing the system cache alone will not fix the issue if it originates in the browser.

Chrome and Edge: type the following in the address bar and click "Clear host cache":

chrome://net-internals/#dns

Firefox: the DNS cache clears automatically when you close the browser. To force it manually, type about:config in the address bar, search for network.dnsCacheExpiration and set the value to 0, then restore it to 60 to re-enable caching.

Safari: enable the Develop menu first (Settings, Advanced, check "Show Develop menu in menu bar"), then click Develop and select "Empty Caches".

When should you flush DNS?

A few situations where this should be the first thing you try:

  • A site shows a DNS error or "This site can't be reached" while it loads fine on mobile data
  • You just changed the DNS servers on your router and the new settings do not seem to be taking effect
  • A website you manage recently moved to a new host and you are still seeing the old content
  • You edited the Windows or Mac hosts file and the changes are not showing up
If flushing the cache does not help, the issue may be on your ISP's side or tied to the TTL of the domain in question, which can take up to 48 hours to propagate fully. A quick test: switch your DNS resolver temporarily to 1.1.1.1 (Cloudflare) or 8.8.8.8 (Google) instead of your ISP's default. If the site loads with those, the problem is confirmed to be a caching issue upstream.