10 June 2019

How to clear DNS cache

DNS cache stores the IP addresses of visited sites on the local computer in order to load them faster the next time.
If you regularly get a 404 error, then clearing the DNS cache can help you. For example, you moved the site to another server and the site has changed the IP address. In order for the browser to open the site from a new IP address, it is necessary to remove the cached IP from the DNS cache.

How to clear DNS cache in the operating system

Ubuntu, Windows and macOS allow clearing DNS cache with a single terminal command.

Windows 10

  1. Open the Start menu and type cmd in the search field. You will find the Command Prompt (cmd.exe). Right click of the mouse will open the context menu. Choose the Run as administrator option.
  2. Type ipconfig/flushdns inside the terminal window and press Enter. Done!
clear dns cache windows 10
Windows Command Prompt

Ubuntu

  1. Search for the Terminal in the applications list or press ctrl+alt+T
  2. Type the sudo systemd-resolve --flush-caches command and then type in the password. Done!
flush dns cache ubuntu
Ubuntu Terminal

macOS 10.14 Mojave

  1. Press the search icon in the top right corner and search for the Terminal.
  2. Inside the terminal window type the sudo killall -HUP mDNSResponder; sleep 2; command and specify the administrator password. Done!
flush dns cache macOS
macOS Terminal

How to clear the DNS cache in the browser

Modern browsers have their own DNS client, which also caches IP addresses. After clearing the cache in the system, we recommend further clearing the DNS cache in the browser.

Google Chrome, Opera, Vivaldi

This method is suitable for clearing the DNS cache in Chromium based browsers.
  1. Type chrome://net-internals/#dns inside the browser field. Press Clear host cache.
  2. Inside the same window choose the Sockets option and press Flush socket pools. Done!
how to clear dns cache chrome
Google Chrome

Mozilla Firefox

  1. In the application menu select Settings.
  2. Open the Privacy and security section, find Cookie and Site Data.
  3. Press the Clear Data button. The new window will appear. Untick the marker near Cookies and Site Data. Press Clear and close the window. .
  4. Done!
how to clear dns cache Firefox
Firefox Clear cache window
If this method did not work, then clear the DNS cache through the browser's fine tuning window.
  1. Open the about:config page and press the I accept the risk.
  2. Inside the search field type network.dnsCacheExpiration. Change the found value to 0, press ОК, then change it back to 60.
  3. Then search for the network.dnsCacheEntries. Then change the value to 0 the same way you did previously, press OK and change it back to 60.
  4. Done!
Firefox fine tuning