Skip to content

How to Clear DNS Cache on Windows and Linux PCs

DNS, or Domain Name System, is a vital part of how the internet works. It translates human-readable domain names into IP addresses, which are needed for devices to communicate with one another. DNS caching is the temporary storage of these translations by your operating system to speed up subsequent requests to the same domain names. However, sometimes you may need to clear the DNS cache to fix connectivity issues or to apply changes to DNS records immediately. In this article, we will discuss how to clear the DNS cache on Windows and Linux PCs.

Clearing DNS Cache on Windows

Clearing DNS Cache on Windows 10 and Windows 11

To clear the DNS cache on a Windows 10 or Windows 11 PC, follow these steps:

  1. Press the Windows key + R to open the Run dialog box.
  2. Type "cmd" (without quotes) and press Enter to open the Command Prompt.
  3. In the Command Prompt, type the following command and press Enter: ipconfig /flushdns
  4. A message should appear, confirming that the DNS cache has been successfully cleared.

Clearing DNS Cache on Windows 8 and 8.1

To clear the DNS cache on a Windows 8 or 8.1 PC, follow these steps:

  1. Press the Windows key + X to open the Quick Access Menu.
  2. Click "Command Prompt (Admin)" to open the Command Prompt with administrative privileges.
  3. In the Command Prompt, type the following command and press Enter: ipconfig /flushdns
  4. A message should appear, confirming that the DNS cache has been successfully cleared.

Clearing DNS Cache on Linux

Clearing DNS Cache on Ubuntu and Debian-based Systems

On Ubuntu and Debian-based systems, DNS caching is typically handled by the systemd-resolved service. Follow these steps to clear the DNS cache:

  1. Open the Terminal by pressing Ctrl + Alt + T or searching for "Terminal" in the application menu.
  2. Type the following command and press Enter: sudo systemd-resolve --flush-caches
  3. Enter your password when prompted. The DNS cache should now be cleared.

Clearing DNS Cache on Fedora, CentOS, and RHEL

On Fedora, CentOS, and RHEL, the caching service is usually provided by the nscd (Name Service Cache Daemon) or dnsmasq.

Clear cache in nscd

  1. Open the Terminal.
  2. Type the following command and press Enter: sudo systemctl restart nscd
  3. Enter your password when prompted. The DNS cache should now be cleared.

Clear cache in dnsmasq

  1. Open the Terminal.
  2. Type the following command and press Enter: sudo systemctl restart dnsmasq
  3. Enter your password when prompted. The DNS cache should now be cleared.

Conclusion

Clearing the DNS cache is a simple process that can help you resolve connectivity issues or apply DNS changes immediately. Whether you're using a Windows or Linux PC, following the steps outlined in this article will help you flush your DNS cache and keep your internet connection running smoothly.