How to Flush DNS on Mac, Windows, and Linux

Flushing your DNS cache can be a useful step in troubleshooting network issues, ensuring that your computer is accessing the most current versions of websites, and solving problems related to outdated or corrupt DNS entries. This blog post will guide you through the steps to flush the DNS cache on Mac, Windows, and Linux.

What is DNS and Why Flush the Cache?

DNS (Domain Name System) is like the phone book of the internet, translating human-friendly domain names into IP addresses that computers use to communicate with each other. Your computer stores recent DNS lookups in a cache to speed up future requests to the same domains.

Flushing the DNS cache can resolve issues such as:

  • Accessing an updated website that has changed IP addresses.
  • Clearing potentially corrupt or outdated DNS entries.
  • Resolving network connectivity issues.

Flushing DNS Cache on Mac

On a Mac, the method to flush the DNS cache depends on the version of macOS you are using. Here are the commands for the most common versions:

macOS Monterey (12.x) and Later:

  1. Open Terminal (Applications > Utilities > Terminal).
  2. Enter the following command and press Enter:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Flushing DNS Cache on Windows

The steps to flush the DNS cache are similar across different versions of Windows.

Windows 10 and Windows 11:

  1. Press Windows + X and select "Command Prompt (Admin)" or "Windows PowerShell (Admin)".
  2. In the Command Prompt or PowerShell window, type the following command and press Enter:
ipconfig /flushdns

Flushing DNS Cache on Linux

On Linux, the steps to flush the DNS cache can vary depending on the distribution and the DNS service in use (e.g., systemd-resolved, dnsmasq, nscd).

For systems using systemd-resolved:

  1. Open Terminal.
  2. Enter the following command and press Enter:
sudo systemctl restart systemd-resolved

Conclusion

Flushing the DNS cache is a straightforward but effective way to resolve various network-related issues. Whether you're using a Mac, Windows, or Linux system, the commands outlined above will help you clear your DNS cache and ensure your computer is accessing the latest and correct DNS information. Regularly flushing your DNS cache can also contribute to better system performance and a smoother internet browsing experience.

The link has been copied!