How to Flush DNS on Windows, Mac, and Linux

Last Updated: October 21, 2025By
Person typing on laptop keyboard at wooden desk

A stubborn website error or a connection that fails without explanation can quickly derail your work. Before you restart your router for the tenth time, a simpler fix might be available.

Flushing your DNS cache forces your computer to erase its outdated local directory of website addresses, compelling it to fetch fresh, accurate information from the internet.

Flush DNS by Operating System

Clearing your DNS cache requires a specific command tailored to your computer’s operating system. The process is generally straightforward but varies between Windows, macOS, and Linux due to their different system architectures and networking services.

Executing the correct command for your platform ensures that all stale DNS records are properly removed, forcing your system to request fresh data from its configured DNS server.

Windows

On Windows systems, you can flush the DNS cache using either the Command Prompt or PowerShell. Both applications must be run with administrative privileges to execute the necessary commands successfully.

To use the Command Prompt, follow these steps:

  1. Open the Start Menu, type cmd, right-click on the Command Prompt icon, and select “Run as administrator.”
  2. In the terminal window that appears, type the command ipconfig /flushdns and press Enter.
  3. The system will confirm the action with the message, “Successfully flushed the DNS Resolver Cache.”

Alternatively, you can use PowerShell:

  1. Open the Start Menu, type PowerShell, right-click the application icon, and select “Run as administrator.”
  2. In the PowerShell window, enter the command Clear-DnsClientCache and press Enter.
  3. This command does not display a confirmation message; a new prompt indicates it has finished.

macOS

Flushing the DNS cache on a modern macOS system is handled through a single command line in the Terminal application. This process clears the cache and restarts the system’s DNS service simultaneously.

  1. Open the Terminal application, located in the Utilities folder inside your Applications folder.
  2. Enter the command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder into the terminal window.
  3. Press Enter to execute the command.
  4. You will be prompted to provide your administrator password. Type it and press Enter.
  5. No confirmation message will appear. A new command prompt signifies that the DNS cache has been flushed successfully.

Linux

The command to flush DNS on a Linux system depends on the distribution’s specific networking service. Most modern Linux distributions use systemd-resolved, while others may use nscd.

For systems that use systemd-resolved, such as recent versions of Ubuntu or Debian:

  1. Open a terminal.
  2. Execute the command sudo systemd-resolve –flush-caches.
  3. To verify the cache was cleared, you can optionally run sudo systemd-resolve –statistics to see the current cache status.

For systems that use nscd (Name Service Caching Daemon):

  1. Open a terminal.
  2. Restart the service using the command sudo systemctl restart nscd.
  3. On older systems that do not use systemd, the command may be sudo /etc/init.d/nscd restart. Restarting the service effectively clears its cache.

Post-Flush Verification and Troubleshooting

After you have flushed your system’s DNS cache, the next step is to confirm that the command worked and to take further action if the original issue remains. A successful flush clears the path for your computer to get the most current network information.

You should expect the first connection to a website after a flush to be slightly slower, as your computer must fetch the address record anew before caching it again. If problems persist, the source may not be your local cache.

Confirm the DNS Flush Was Successful

Verifying that the DNS cache has been cleared provides immediate feedback and confirms you can move on to other troubleshooting steps if necessary. The method for confirmation depends on the operating system you are using.

  • On Windows, the ipconfig /flushdns command provides a clear confirmation message: “Successfully flushed the DNS Resolver Cache.” If you used the PowerShell command, the absence of an error is your confirmation.
  • On macOS, the Terminal does not give a success message. A new, blank command prompt line appearing after you execute the command is the signal that it completed without errors.
  • On Linux, users with systemd-resolved can run sudo systemd-resolve –statistics to view the current cache size, which should be at or near zero after a flush.

Clear Browser and Router Caches

If flushing your operating system’s DNS cache does not resolve the connectivity issue, the outdated record may be stored elsewhere. Web browsers and network routers both maintain their own separate caches to speed up performance.

  • Browser Cache: Modern web browsers like Google Chrome, Firefox, and Edge keep their own DNS caches. To clear Chrome’s cache, you can navigate to the internal page at chrome://net-internals/#dns and click the “Clear host cache” button. Other browsers have similar options available in their advanced settings or troubleshooting menus.
  • Router Cache: Your router also caches DNS information to manage traffic for all devices on your local network. The most reliable way to clear a router’s cache is to perform a full power cycle. Unplug the router from its power source, wait for about 30 seconds, and then plug it back in.

Address Persistent Connection Issues

When connection problems continue after you have cleared all local and network caches, the issue likely originates from an external source. At this point, you should investigate your DNS resolver and consider the possibility of DNS propagation delays.

  • Test a Different DNS Resolver: Your internet service provider (ISP) typically assigns a default DNS resolver, which can sometimes be slow or have outdated records. You can manually change your device’s DNS settings to use a public resolver, such as Google’s (8.8.8.8) or Cloudflare’s (1.1.1.1), to see if that fixes the problem.
  • Account for DNS Propagation: When a website’s address changes, it can take time for that new information to spread across all DNS servers worldwide. This process, known as propagation, can last anywhere from a few minutes to 48 hours or more, depending on the domain’s Time to Live (TTL) settings. If a site recently moved, you might simply need to wait for the changes to reach your DNS resolver.

Conclusion

Flushing your DNS cache is a direct and powerful first step for resolving network errors that arise from outdated local records. For a comprehensive fix, this action is best combined with clearing the caches in your browser and router.

If connectivity issues continue, the problem likely exists upstream, requiring you to investigate your DNS resolver settings or account for record propagation delays. Because the commands and services vary between operating systems, it is crucial to select the correct method for your platform and verify the result before proceeding with more extensive network diagnostics.

About the Author: Elizabeth Baker

1b6e75bed0fc53a195b7757f2aad90b151d0c3e63c4a7cd2a2653cef7317bdc7?s=72&d=mm&r=g
Elizabeth is a tech writer who lives by the tides. From her home in Bali, she covers the latest in digital innovation, translating complex ideas into engaging stories. After a morning of writing, she swaps her keyboard for a surfboard, and her best ideas often arrive over a post-surf coconut while looking out at the waves. It’s this blend of deep work and simple pleasures that makes her perspective so unique.