How to Clear DNS Cache

Written on October 28, 2016. Updated on November 09, 2017

DNS (Domain Name System) is like a phone book for the world wide web. Every website and domain is mapped to an IP address. When you type Google.com into your address bar, DNS does the mapping for you behind the scenes. Without DNS you would have to type something like 216.58.217.206 to get to Google. Wouldn’t that be fun!

We then have DNS cache. Just like caching on your WordPress site, DNS cache stores the IP addresses (or locations) you have recently visited locally on your computer. If DNS records become out of date or things change on the web server, you might have to clear DNS cache in order to grab the most up to date records.

clear dns cache

DNS Cache Case Scenario

Here is a case scenario that actually happened to us on a client’s site the other day. The client suddenly complained about their images and CSS/Javascript not loading on their website. Their website was loading just fine for us and they ensured us they hadn’t made any recent changes. Upon inspecting their site with Chrome Devtools we could see that everything from their CDN subdomain (cdn.domain.com) were not loading correctly and reporting 404 errors.

So the first thing we did was ping the CDN subdomain to see if it was accessible to us. It returned a response just fine. We then ran their CDN URL through the free whatsmydns tool. This allows you to quickly check resolution on DNS records (such as the CDN CNAME) from multiple geographical locations. We wanted to ensure it was loading fine everywhere, beyond just our physical location and that it was resolving back to their CDN provider. And it was.

whatsmydns cname resolution

So after the above digging we confirmed that their was a small change with their DNS provider which was still cached on the client’s end. So we had them clear their DNS cache locally on their computer, refresh the page, and everything started loading again on their WordPress site. Follow the steps below to clear DNS cache on your computer.

Clear DNS Cache Windows

To clear DNS cache on Windows, follow the steps below:

  1. Launch the start menu by pressing the Windows key and search for “CMD.” This should return the command prompt.
    command prompt windows
  2. In command prompt run the following command:
    ipconfig /flushdns

    ipconfig flush dns

  3. You will then see a confirmation that it has successfully flushed the DNS resolver cache.
    flushed dns resolver cache

Clear DNS Cache Mac

To clear DNS cache on a Mac, follow the steps below:

  1. Click Applications.
  2. Click Utilities.
  3. Click Terminal.
  4. Run the following command. You will need administrator access to do this. If it works, you won’t see any response.
    sudo killall -HUP mDNSResponder

    clear dns cache mac

After clearing the DNS cache you can then try accessing the domain or website again that was having issues.

Was this article helpful?
No, or there was something off

Hand-picked related articles

Send this to a friend