What DNS cache is and why you might need to clear it

DNS cache is a record your computer keeps of website addresses it has already looked up. When you type a website name into your browser, your computer checks this cache first before asking the internet for the real address. This speeds things up — but sometimes the cached address becomes wrong or outdated, and your computer keeps trying to reach a website that has moved or changed.

Clearing the DNS cache forces your computer to look up fresh addresses the next time you visit a site. This solves problems like a website showing an old version, a site appearing down when it is actually working, or a domain redirecting to the wrong place. It is one of the first things to try when a specific website stops working but your internet connection itself is fine.

Key Takeaways

  • DNS cache stores old website addresses on your computer, and clearing it makes your system look up fresh ones on the next visit.
  • On Windows, you open Command Prompt as administrator and type ipconfig /flushdns, then press Enter.
  • On Mac, you open Terminal and type sudo dscacheutil -flushcache, then enter your password when prompted.
  • On Linux, the command depends on your system — most use sudo systemctl restart systemd-resolved or sudo /etc/init.d/nscd restart.
  • Clearing DNS cache takes seconds and causes no harm, even if it does not fix your problem.

How to clear DNS cache on Windows

Open the Start menu and type Command Prompt into the search box. Right-click on Command Prompt and select Run as administrator — this is required for the command to work. A black window will open.

Type the following exactly as shown and press Enter:

ipconfig /flushdns

You should see a message that says "Successfully flushed the DNS Resolver Cache." Close the Command Prompt window. Your DNS cache is now cleared, and the next time you visit a website, your computer will look up its current address instead of using the old one.

How to clear DNS cache on Mac

Open the Applications folder, go to Utilities, and double-click Terminal. A text window will open.

Type the following exactly as shown and press Enter:

sudo dscacheutil -flushcache

Your computer will ask you to enter your password — this is the same password you use to log into your Mac. Type it in (you will not see the letters appear) and press Enter. The cache is now cleared. If you see no message at all, that is normal — the command worked silently.

How to clear DNS cache on Linux

Open a terminal window. The method depends on which DNS service your system uses, so try the first command first. Type the following and press Enter:

sudo systemctl restart systemd-resolved

If you see an error message, try this command instead:

sudo /etc/init.d/nscd restart

Your computer will ask for your password. Enter it and press Enter. If neither command produces an error, the cache has been cleared. Some Linux systems use other DNS services — if both commands fail, check your system documentation or contact your Linux distribution's support.

When clearing DNS cache actually solves the problem

Clearing DNS cache works best when a website you know is working appears broken only on your computer. Signs that DNS cache is the culprit include: a site shows an old version of itself, a domain redirects to the wrong place, a site appears down but works on someone else's network, or an error message mentions DNS.

It does not work if the problem is your internet connection itself, your router, or a website that is actually down everywhere. If clearing the cache does not fix the problem within a minute or two, the issue is something else — try restarting your router or checking whether the website is down for everyone using a site like DownDetector.

Other ways to clear DNS without using the command line

If you do not want to use Command Prompt or Terminal, you can restart your router instead. Unplug it for 30 seconds, plug it back in, and wait for it to fully restart. This clears the DNS cache on the router itself, which often solves the same problems. Your computer's local cache will also clear after a few hours on its own.

Some browsers also keep their own DNS cache separate from your computer's. In Chrome, go to chrome://net-internals/#dns, click the Clear host cache button, then reload the website. In Firefox, this happens automatically and you cannot clear it manually — clearing your computer's cache is enough.

What happens after you clear DNS cache

Clearing DNS cache causes no problems — it straightforward means your computer will spend a fraction of a second longer on the next website visit while it looks up the current address. You will not notice the difference. If a website still does not work after clearing the cache, the problem is not DNS, and you should move on to other troubleshooting steps like checking your internet connection or trying a different browser.

You can clear DNS cache as often as you want. Some people do it monthly as part of routine maintenance, though it is not necessary unless you are having problems. The cache will rebuild automatically as you visit websites.

Frequently Asked Questions

Will clearing DNS cache delete my passwords or browsing history?

No. DNS cache only stores website addresses, not passwords, history, or any personal information. Clearing it is completely safe and affects nothing except how your computer looks up website locations.

Do I need to clear DNS cache on my phone?

Phones handle DNS differently than computers. On iPhone, restart the phone or toggle airplane mode on and off. On Android, go to Settings, Apps, and find your browser, then tap Storage and select Clear Cache. This is simpler than the command-line method on computers.

Why does my website still not work after clearing DNS cache?

DNS cache is only one possible cause. If clearing it does not help within a minute, try restarting your router, checking whether the website is down everywhere, or trying a different browser. The problem may be your internet connection, your router, or the website itself.

How often should I clear DNS cache?

Only clear it when you are having problems with a specific website. Routine clearing is not necessary — your cache clears automatically over time, and the system works fine without manual clearing.