How to do a Flush DNS on Windows, Linux and Mac OS

DNS is key to browsing the Internet

DNS (Domain Name System) is a key component of Internet browsing, translating friendly domain names into IP addresses that computers can understand. However, your system may store those addresses in its DNS cache for a time, which may become stale or incorrect. Performing a “DNS Flush” or “cleaning DNS” is a basic troubleshooting step that can help fix connectivity issues. Next, I will explain how to perform this action in the most common operating systems: Windows, Linux and Mac OS X.

Windows

  1. Press the Windows key and type cmd in the search.
  2. Right-click on “Command Prompt” and select “Run as administrator.”
  3. In the Command Prompt window, type the following command and press Enter:

    ipconfig /flushdns
    
  4. You should see a message confirming that the DNS cache has been successfully flushed.

Linux

On Linux, the process varies slightly depending on which DNS caching service your system is using. For systems that use nscd:

  1. Open a terminal.
  2. Type the following command and press Enter:

    sudo /etc/init.d/nscd restart
    

Or if your system is using systemd-resolved:

  1. Open a terminal.
  2. Type the following command and press Enter:

    sudo systemctl restart systemd-resolved
    

macOS

  1. Open the terminal (you can find it in Applications > Utilities).
  2. Depending on your version of macOS, the command may vary. For recent versions, type the following command and press Enter:

    sudo killall -HUP mDNSReply
    

    You will need to enter your administrator password to run it.

    For older versions of Mac OS X, the command can be one of the following:

    sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder
    
  3. There is no confirmation prompt on Mac, but the command will restart the DNS service and flush the cache.

Performing a DNS Flush is a quick and easy method that often fixes network connectivity issues, and it's good to know how to do it on any operating system you may be using.

Scroll to Top