How to clear your local DNS cache with DNS FLUSH command?

When transferring a domain name to us or when updating your DNS servers for the domain, your local computer DNS servers might be still resolving your old site IP address, which will lead to either you not being able to access your new site or you accessing the site hosted with your previous hosting company. Usually after certain period of time (24-72 hours) your local computer will naturally start to resolve your new site IP, and you will start seeing your site hosted with us (instead of your old provider). Clearing your local computer DNS cache (also called DNS FLUSH) could help expedite this process and in 90% of the time you will be able to access your new site immediately. Sometimes support engineers will tell you to flush it when you have some problems on your PC such as some websites are not opening, internet connection is not working properly, slow loading of websites, slow processing speed, etc.

This article explains in general couple of different options, which are different depending on your operating system. These are just sample procedures for 100% accuracy please, double check your Operating System version, and check on the exact commands you can use to Clear your DNS cache (DNS FLUSH).

What is DNS Cache?

A DNS cache is a temporary database on your PC which is operated and managed by the operating system. This database has records of all the new site visits and attempted visits to sites. The record usually includes the domain names along with their similar IP addresses.

Internet totally relies on the Domain Name System, i.e., DNS to manage an index of all the sites on the internet and their similar IP addresses. And it’s like your phone book in which you write names and their similar phone numbers. Every site has an IP address on the internet but getting those numbers is almost impossible for us, that is where DNS (Domain Name System)comes into use. It has alphanumeric names to the IP addresses which are very easy to remember.

When DNS cache is active, you see the sites you have recently opened, are opening more immediately when you load it next time.

What is the Purpose of DNS Cache?

The internet relies on the Domain Name System to manage an index of all public sites and their similar IP addresses. You can think of it as a phone book. With a phone book, we don’t have to remember everyone’s phone number. In the same way, DNS is used so we can simply avoid having to remember every site’s IP address, which is the only way network devices can interact with sites.

Flush DNS Cache

How DNS Cache Works?

Whenever a browser creates a request to the external or outside network, the PC stops each one and looks up the domain name in the DNS cache database. The database includes a list of all newly entered domain names and the addresses that DNS thought for them the first time a request was made. The contents of a local DNS cache can be seen on windows using the command displaydns/ipconfig. In DNS, the “A” record is the part of the DNS entry that includes the IP address for the given hostname. The DNS cache stores this address, the requested site name, and some other parameters from the host DNS entry.

Flushing DNS Cache

If you are finding an answer to what command can be used to clear or flush DNS cache on your windows, MAC or Linux computer, please refer to the instructions given below.

Flush DNS Cache on Windows 10

Close all Internet applications that you are using, such as email client, and web browsers.

  1. Go to your Windows Start Search bar, and type Command Prompt.
  2. You will see Command Prompt. Simply Right click on Command Prompt, and then click “Run as Administrator”.
  3. This will start Command Prompt in Admin mode.
  4. At the command prompt screen, type ipconfig/flushdns and press ENTER KEY.

Once the DNS cache is flushed successfully, you will get the confirmation message like;

Windows IP configuration
Successfully flushed the DNS resolver cache

Flush DNS Cache on Windows 8

Close all Internet applications that you are using, such as email client, and web browsers.

  1. Click on the Windows Logo + R keys at the same.
  2. Type in cmd in the text box, and then click OK. This will open the command prompt.
  3. At the command prompt screen, type the following command and then press the ENTER KEY:

    ipconfig /flushdns

Flush DNS Cache on Windows 7

Close all Internet applications that you are using, such as email client, and web browsers.

  1. Click on the Start button (circle) and then "All Programs", and then go under "Accessories", and right-click Command Prompt.
  2. Then choose Run as Administrator.
  3. At the command prompt screen, type this ipconfig /flushdns command in the command line and press ENTER KEY.

Flush DNS Cache on Mac OS X

The Mac OS X releases are changing constantly, and the DNS flush methods are changing constantly. Please, review the following article from Apple on how to flush your DNS for your specific Mac OS X version: https://support.apple.com/en-us/HT202516

In Mac OSX Leopard, you can use the command dnscacheutil -flushcache to flush the DNS resolver cache:

bash-2.05a$ dscacheutil –flushcache

In Mac OSX versions 10.5.1 and before, the command lookupd -flushcache performed the same task:

bash-2.05a$ lookupd -flushcache

In combination with the above you may need to reboot your computer and/or clear your browser cache.

Flush DNS Cache on Linux

The exact steps on how to flush DNS under Linux really depend on the installed Linux distribution, and installed system packages. Please, check with your distribution documentation on the exact steps you need to take to Flush your DNS cache. Please, note that some distributions by default do not install DNS caching service, so flushing the DNS cache might not be required or possible without further package manipulation.

Normally you will need to restart the caching service, or if you have local name server by using commands such as:

/etc/init.d/nscd restart
/etc/init.d/named restart
or nscd -I hosts

Flush DNS Cache on Browsers

If you have recently set up your filtering, or simply changed a setting, a cache clear or flush may be important before you see your filtering take effect.

So then the following table gives most easy instructions for clearing or flushing the DNS cache within common internet browsers.

  1. Internet Explorer (Windows) - First, go to the History menu, then choose Delete Browsing History, and then check all boxes (except passwords, if desired) then simply click Delete.
  2. Google Chrome (Windows) - Firstly, open the Wrench Icon in the upper right corner and choose History and check all boxes. And then under Clear data for this time period, choose everything(except passwords, if desired) and then click Clear Browsing Data.
  3. Mozilla Firefox (Windows) - For this simply click on Firefox at the top left of your browser, then go to the History menu, and choose Clear Recent History and check all boxes. Under Time range to clear choose everything (except passwords, if desired) and then click Clear Now button.
  4. Apple Safari (Windows) - First, go to the Safari menu, and choose Reset Safari, then finally check all boxes and then click Reset.

Conclusion

Therefore, that’s all about how to clear or flush DNS cache. Clearing or flushing DNS cache looks like a small thing, but it fixes many problems on your computer or laptop. And for which sometimes you look for a computer expert to fix. So, either bookmark this post/guide or keep the codes with you in a notepad or remember these to use them when needed.

If you have any problems understanding about the flush DNS cache, do ask in the comments, we would love to try answering your queries or doubts.