Domain Name System (DNS) caching is a mechanism used to speed up the resolution of domain names to IP addresses. When you type a domain name into a web browser - URL Address, the browser first needs to find out the IP address of the server hosting the website before it can connect to it. This is done through the domain name system, which translates domain names into IP addresses.

What is DNS caching?

When a computer or network device makes a DNS query, the result is cached so that the next time the same domain is requested, name resolution can be faster. This means that instead of having to make a new DNS query each time a website is visited, the computer can use the cached result to connect to the server more quickly.

ISPs (Internet Service Providers) and home routers often have their own DNS cache to store recent queries, which helps speed up user connections. However, it may sometimes be necessary to clear the DNS cache to fix connection issues or to ensure that your computer is using the latest version of DNS information.

Why clean DNS cache regularly?

Clearing the DNS cache regularly may be necessary for a few reasons:

  • Fix Connection Issues: If the DNS cache is corrupted or outdated, it can cause internet connection issues like failures to access specific websites. In such cases, clearing the DNS cache may help resolve the issue.

  • Update DNS information: Sometimes Internet service providers or DNS servers update their DNS information to provide better and more up-to-date services. Clearing the DNS cache ensures that the computer or network device is using the most recent version of this information.

  • Protect privacy: DNS cache can store information about the websites you have visited, which can be a privacy issue. Clearing your DNS cache regularly helps protect your online privacy.

In general, it’s not necessary to clear your DNS cache on a regular basis, but if you’re experiencing Internet connection issues or are concerned about your privacy, it might be a good idea to do so occasionally. Frequency may depend on how heavily your system is used, but generally a monthly or bi-monthly cleaning should be sufficient for most users.

Clearing the DNS cache

How to Clear DNS Cache in Windows

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

  • Open Command Prompt: Press “Windows + R” keys to open the “Run” dialog box, type “cmd” and press “Enter” or click “OK”.
  • Type the command: In the Command Prompt window, type the following command and press “Enter”: ipconfig /flushdns
  • Wait for confirmation: Wait a few seconds until you receive confirmation that the DNS cache has been cleared. This should appear as a message stating “The computer’s DNS cache has been cleared”.
  • Close the Command Prompt window: When the process is complete, close the Command Prompt window.

With that, your Windows system’s DNS cache will have been cleared. Please note that it may take a few minutes for the new DNS information to be updated.

How to Clear DNS Cache in Linux Ubuntu and Linux Mint

To clear the DNS cache in Ubuntu or Linux Mint, follow these steps:

  • Open the terminal: Press “Ctrl + Alt + T” keys to open the terminal.

  • Type the command: In the terminal window, type the following command and press “Enter”: sudo systemd-resolve --flush-caches

  • Alternative command: you can also use DNS-Clean, it is also available in all Linux distributions.. Type the following command in the terminal and press Enter: `sudo /etc/init.d/dns-clean start

  • Enter your admin password: Depending on your system settings, you may need to enter your admin password to confirm the action.

  • Wait for confirmation: Wait a few seconds until you receive confirmation that the DNS cache has been cleared. This should appear as a message indicating that “DNS caches have been cleared”.

  • Close the terminal: When the process is complete, close the terminal window.

With that, your Ubuntu or Linux Mint system’s DNS cache will have been cleared. Please note that it may take a few minutes for the new DNS information to be updated.

How to Clear DNS Cache on MacOs

To clear DNS cache on macOS, follow these steps:

  • Open Terminal: Go to Finder and select “Applications” > “Utilities” > “Terminal” to open Terminal.

  • Depending on the version of your MacOs you will have to type a different command:

    • MAC OS Sierra, X El Capitan, X Mavericks, X Mountain Lion or X Lion version, command sudo killall -HUP mDNSResponder
    • Mac OS X Yosemite version, sudo discoveryutil udnsflushcaches command
    • MAC OS X Snow Leopard version, sudo dscacheutil -flushcache command
    • MAC OS X Leopard version or older, sudo lookupd -flushcache command.
  • Enter your admin password: Depending on your system settings, you may need to enter your admin password to confirm the action.

  • Wait for confirmation: Wait a few seconds until you receive confirmation that the DNS cache has been cleared. This should appear as a message indicating “mDNSResponder restarted successfully”.

  • Close Terminal: When the process is complete, close the Terminal window.

With that, your macOS system’s DNS cache will have been cleared. Please note that it may take a few minutes for the new DNS information to be updated.

Final considerations

DNS caching is an important technology to speed up resolution of domain names to IP addresses and improve Internet connection speed. However, it may sometimes be necessary to clear the DNS cache to fix connection issues or to ensure that the system is using the latest version of DNS information.

Clearing the DNS cache is usually a simple task that can be done with a few commands at the command prompt or terminal. It is important to remember that the cleanup process may take a few minutes for the new DNS information to be updated.

In general, we recommend clearing the DNS cache only when necessary, but there is no specific timeline for doing so. Depending on system usage, cleaning can be done every few months or as needed to troubleshoot connection issues.