Flush DNS Cache

How to Flush DNS Cache Windows, macOS, Linux

host2go managed wordpress

How to Flush DNS Cache on Windows, macOS, and Linux

Flushing your DNS cache is a simple but powerful way to solve various internet connectivity issues. Whether a website won’t load, you’re seeing an outdated version of a page, or changes to your domain name settings aren’t showing up, clearing your DNS cache can often help. In this guide, we’ll explain what the DNS cache is, why flushing it matters, and exactly how to do it on Windows, macOS, and Linux.

What Is DNS and Why Does It Have a Cache?

DNS stands for Domain Name System. It acts like the phone book of the internet by translating human-friendly domain names (like example.com) into IP addresses that computers use to locate each other on the web.

To speed things up, your operating system stores DNS responses locally. This is called the DNS cache. It helps your computer remember sites you’ve already visited so they load faster the next time. However, this cache can sometimes become outdated or corrupted.

For example:

  • A website has moved to a new server and changed its IP address.

  • You’ve recently switched hosting providers or updated DNS records.

  • You’re seeing errors like “Server not found” or incorrect page loads.

In these cases, your computer may still be using the old cached DNS info, causing problems. The solution? Flush (clear) the DNS cache so your system fetches fresh information.

How to Flush DNS Cache on Different Operating Systems

Let’s break down how to flush DNS on Windows, macOS, and various Linux systems.

1. How to Flush DNS on Windows

Works on Windows 11, 10, 8, and 7.

  1. Press the Windows key + R to open the Run dialog.

  2. Type cmd and press Enter to open the Command Prompt.

  3. In the Command Prompt, type the following command:

ipconfig /flushdns
  1. Press Enter.

You should see a message saying:

Successfully flushed the DNS Resolver Cache.

That’s it! Your Windows machine has now cleared the DNS cache and will start retrieving fresh DNS data the next time you access websites.

2. How to Flush DNS on macOS

Steps vary slightly depending on your version of macOS, but most recent versions use the same method.

  1. Open Terminal (found in Applications > Utilities or use Spotlight search).

  2. Enter the following command:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  1. Press Enter.

  2. You’ll be prompted to enter your admin password (you won’t see characters as you type).

  3. Press Enter again.

Note: macOS doesn’t show a success message, but the cache will be flushed.

If you’re using an older version of macOS (before Yosemite), the command may differ slightly. For example:

sudo discoveryutil mdnsflushcache

If you’re unsure, use Apple’s support page or consult your version’s release notes for the correct command.

3. How to Flush DNS on Linux

Linux systems use various DNS services, so the method depends on which one your system is using.

If you’re using systemd-resolved:

sudo systemd-resolve --flush-caches

You can verify the cache size with:

systemd-resolve --statistics

If you’re using nscd (Name Service Cache Daemon):

sudo /etc/init.d/nscd restart

If you’re using dnsmasq:

sudo /etc/init.d/dnsmasq restart

If you’re using BIND (Berkeley Internet Name Domain):

sudo rndc flush

Always check which DNS caching service your distribution is using before running any commands.

Conclusion

Flushing your DNS cache is an easy way to solve a wide range of internet connectivity issues. Whether you’re a casual user or a system admin, knowing how to clear the DNS cache on your device can save you a lot of troubleshooting time. Try flushing the DNS cache anytime you’re having issues with websites not loading, redirecting incorrectly, or not updating after changes to the domain.

If you’re running a business or hosting a website, it’s also helpful to ask your clients or users to flush their DNS after DNS record changes, especially when migrating servers.

Still having trouble after flushing your DNS? You may also want to try:

  • Restarting your router

  • Switching to a different DNS provider like Google DNS or Cloudflare DNS

  • Clearing your browser cache