How to Flush DNS Cache
access_time
hourglass_empty
person_outline

How to Flush DNS Cache

If you’re having connection issues, you might want to clear your DNS cache. In this article, you’ll learn the benefits of it and how to flush DNS cache on popular operating systems.

Reasons to Flush DNS Cache Periodically

Similar to web browsers, operating systems also store cache files called Domain Name System (DNS) cache. The cache files contain information about all visited websites — hostnames, IP addresses, and resources records.

Most operating systems perform DNS caching to lessen DNS servers’ burden during high traffic. The caches’ validity period is determined by Time To Live (TTL). As long as the cache files are still valid, they will answer content requests without having to go through the DNS server.

Despite so, using corrupt or outdated DNS cache files can lead to error and security vulnerabilities. Therefore, we recommend you to flush DNS cache periodically.

Here are the reasons why you should clear DNS cache regularly:

  • Prevent search behavior tracking — storing DNS records makes it easier for hackers to predict your browser history.
  • Security — DNS cache files are the main target for DNS spoofing, which endangers users’ sensitive information like login credentials and personal data.
  • Solve technical problems — forcing the operating system to search updated DNS records can solve connection issues and incorrectly displayed web content.

Ways to Flush DNS Cache

Depending on your operating system, the steps to flushing DNS cache may vary. The tutorial below will show you how to do it in Windows, Linux, and Mac OS X.

Microsoft Windows

The following tutorial is applicable for Windows XP, 7, Vista, 8, 8.1, and 10.

  1. Press Windows+R keys together to open Windows command prompt console, then enter cmd.
  2. Type the following command to clear DNS cache files on your computer:
    ipconfig /flushdns
  3. If the process is successful, you’ll see the confirmation message as follows:
    This image shows the confirmation message that you have successfully flushed DNS cache in Microsoft Windows operating system.

Linux

By default, Ubuntu doesn’t cache DNS records. If you manually install a DNS service like name service caching daemon (nscd), the steps below will show you how to flush DNS cache.

  1. Press Ctrl+Alt+T keys together to open the terminal window.
  2. Enter the following command to clear DNS cache files on init.d subdirectory:
    sudo /etc/init.d/nscd restart

Mac OS X

  1. Press the F4 key, then enter terminal in the Launchpad’s search field to open the terminal window.
  2. If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following command:
    sudo killall -HUP mDNSResponder
  3. To flush DNS cache on Mac OS X Yosemite, enter the statement:
    sudo discoveryutil udnsflushcaches
  4. If you’re running on Mac OS X Snow Leopard, use the command:
    sudo dscacheutil -flushcache
  5. For Mac OS X Leopard and below, enter the following command to flush DNS cache:
    sudo lookupd -flushcache

Conclusion

When experiencing connection issues or seeing incorrectly displayed web pages, your system might be storing corrupt or outdated DNS cache records. You can quickly solve it by flushing the DNS cache. If the problem isn’t resolved, you can check this tutorial on how to clear your browser cache instead.

The Author

Author

Domantas G. / @domantas

Domantas leads the content and SEO teams forward with fresh ideas and out of the box approaches. Armed with extensive SEO and marketing knowledge, he aims to spread the word of Hostinger to every corner of the world. During his free time, Domantas likes to hone his web development skills and travel to exotic places.

Related tutorials

Author

Cesar Devesa Reply

May 13, 2018

To check DNS and IP addresses accessed by Chrome, you can go to: chrome://net-internals/#dns

    Author

    Gediminas B.

    Replied on May 23, 2018

    Hello, Cesar I appreciate your input. I was not aware of the provided tool and it seems really useful!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become a part of Hostinger now!

More in DNS
How to Change a Domain’s Nameservers (Point to Another Provider)

Close