How to Flush the DNS Resolver Cache on Windows, macOS, and Linux

Flushing the DNS resolver cache can help solve internet connectivity issues and ensure that your system uses the most up-to-date DNS information. This article provides step-by-step instructions for clearing the DNS cache on Windows 11/10, macOS, and Linux.

For Windows 11/10 Users

  1. Open Command Prompt

    • Press Windows + S to open the search bar.
    • Type cmd or Command Prompt.
    • Right-click on Command Prompt and select Run as administrator.
  2. Flush the DNS Cache

    • In the Command Prompt window, type ipconfig /flushdns and press Enter:
      Viewer window
    • You should see a confirmation message stating that the DNS Resolver Cache was successfully flushed:
      Viewer window

For macOS Users

  1. Open Terminal

    • Open Spotlight by pressing Command + Space.
    • Type Terminal and press Enter, or you can find the Terminal application in the Utilities folder within Applications.
  2. Flush the DNS Cache

    Depending on your version of macOS, enter the appropriate command below and press Enter. You may need to enter your administrator password to execute the command.

    • For macOS 10.11 (El Capitan) and later:
      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    • For macOS 10.10 (Yosemite):
      sudo killall -HUP mDNSResponder
    • For macOS 10.9 (Mavericks), 10.8 (Mountain Lion), and 10.7 (Lion):
      sudo dscacheutil –flushcache
    • For macOS 10.6 (Snow Leopard):
      sudo lookupd –flushcache

For Linux Users

Flushing the DNS cache on Linux depends on the DNS service used, such as nscd, dnsmasq, or systemd-resolved.

For systemd-resolved (common in newer distributions):

  • Open a terminal window.
  • Enter the following command:
    sudo systemd-resolve --flush-caches

For nscd:

  • Open a terminal window.
  • Enter the following command:
    sudo systemctl restart nscd

For dnsmasq:

  • Open a terminal window.
  • Enter the following command:
    sudo systemctl restart dnsmasq

Conclusion

Flushing your DNS cache is a straightforward process that can resolve many common internet connectivity issues. If you continue to experience problems after flushing your DNS cache, consider checking your internet connection or contacting your ISP for further assistance.

Tags: Connectivity

Was this article helpful?