How to flush DNS: A step-by-step guide for Windows, macOS, Linux, and web browsers

The steps to flushing DNS varies by operating system and web browser. To flush your computer’s DNS, open your system’s command-line interface and run the DNS deletion commands as an administrator. For browsers, access the DNS management page and select the cache deletion option.
Flushing DNS clears corrupted or outdated data in your system to help resolve connectivity issues and improve security. Whether you’re an administrator or a regular user, knowing how to do it can save you time and frustration.
Short on time? Check out this video tutorial for a quick and easy walkthrough on how to flush DNS.

We’ll cover the steps for each system and explore use cases where this process is helpful. But first, let’s understand what DNS cache is, how it works, and the benefits of clearing it.
What is a DNS cache?
A DNS cache is a file your device creates to remember how to find websites. It stores details like a website’s IP address after you visit it, so your browser can load the site faster next time.
This data comes from a process called a DNS lookup, where your browser contacts a domain name system (DNS) server to get the information.
However, the cache can become outdated or corrupted, which can stop your browser from loading the site correctly. In this situation, you need to clear the DNS cache so your browser can get fresh data.

How to flush DNS cache on different operating systems
The steps to flush the DNS cache differ across operating systems. We’ll explain how to do it on Windows, macOS, and Linux.
How to flush DNS cache on Windows 10 and Windows 11
Flushing DNS on Windows is similar across most versions, especially newer ones. Here’s how:
- Click the Start button and look for Command Prompt by entering cmd into the search bar.
- Right-click Command Prompt and select Run as administrator.
- Enter the following flush DNS command:
Ipconfig /flushdns
Your system will automatically delete the stored DNS cache and reset the resolver settings. Once the process is complete, you should see a confirmation message in Command Prompt.

Important! Make sure to launch Command Prompt as an administrator. Otherwise, you won’t have the necessary permissions to flush the DNS cache.
How to flush DNS cache in macOS
Flushing the DNS cache in macOS is trickier since it requires different commands depending on the operating system version. However, the general procedure is the same:
- Click the magnifying glass icon on the top menu bar. Alternatively, press Command + spacebar.
- In the Spotlight Search menu, find Terminal. Hit Enter.
- Based on your MacOS version, type the following command to flush the DNS cache:
- macOS Big Sur (11), Monterey (12), Ventura (13), Sonoma (14), and Sequoia (15): sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- macOS El Capitan (10.11), Sierra (10.12), High Sierra (10.13), Mojave (10.14), or Catalina (10.15): sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
- macOS Yosemite (10.10): sudo discoveryutil udnsflushcaches
sudo discoveryutil udnsflushcaches
- macOS Lion (10.7), Mountain Lion (10.8), or Mavericks (10.9): sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
- macOS Snow Leopard (10.6): sudo dscacheutil -flushcache
sudo dscacheutil -flushcache
- macOS Leopard (10.5): sudo lookupd -flushcache
sudo lookupd -flushcache
- macOS Big Sur (11), Monterey (12), Ventura (13), Sonoma (14), and Sequoia (15):
- If Terminal asks for authorization, enter your user password. This will grant you the required admin privileges to run the command.
On macOS, most DNS cache flush commands usually don’t show a confirmation message, even when they work. If you run the command and don’t see an error, it has likely completed successfully.
You can also check by visiting a website you recently accessed ‒ it’s a good sign if it takes slightly longer to load or the previous error is gone.
Pro Tip
Still having issues? See our guide on DNS server not responding on Windows and macOS for more troubleshooting tips.
How to flush DNS cache in Linux
Commands to clear DNS cache in Linux vary by distribution since they might use different DNS services. For example, Ubuntu uses dnsmasq, while Red Hat Enterprise Linux typically utilizes NCSD.
If you are unsure which DNS service your system uses, check it by running the following command in Terminal. Replace dns_service with dnsmasq, ncsd, or bind:
sudo systemctl status dns_service
Here’s the general procedure to flush DNS caches on a Linux system:
- Press Ctrl + Alt + T to open Terminal.
- Enter these commands according to the DNS service your distribution uses:
- Dnsmasq: sudo /etc/init.d/dnsmasq restart
sudo /etc/init.d/dnsmasq restart
- NCSD: sudo /etc/init.d/nscd restart
sudo /etc/init.d/nscd restart
- BIND: sudo /etc/init.d/named restart && sudo rndc restart && sudo rndc exec
sudo /etc/init.d/named restart && sudo rndc restart && sudo rndc exec
- Dnsmasq:
- Enter your account password to authorize the command execution. If you log in as root, you can skip this step.
The DNS service will stop briefly and reboot. If systemctl can’t find any of the DNS services, use the following command to flush the cache:
sudo resolvectl flush-caches
How to flush DNS cache on web browsers
Since web browsers typically store their own DNS cache, you might need to flush them separately. Here’s how to do it in popular browsers:
- Open your web browser.
- In the address bar, enter the following address based on your browser:
- Google Chrome: chrome://net-internals/#dns
chrome://net-internals/#dns
- Microsoft Edge: edge://net-internals/#dns
edge://net-internals/#dns
- Firefox: about:networking#dns
about:networking#dns
- Opera: opera://net-internals/#dns
opera://net-internals/#dns
- Google Chrome:
- Press Enter to open the DNS management page.

- Click the button that says Clear host cache or Clear DNS cache. The name depends on your browser.
- Restart your web browser, and it should redownload all the DNS details when you revisit a website.
Important! Safari doesn’t have a page for flushing the DNS cache and uses the system-level configuration instead. This means resetting your macOS system’s DNS will also flush the web browser’s data.
Why flush DNS?
Flushing DNS cache removes outdated or incorrect data that may cause issues when loading websites. While DNS caches usually clear themselves after a set time (known as the time-to-live or TTL), certain situations require a manual reset.
One common situation is dealing with website issues. If a website isn’t loading correctly, clearing DNS cache forces your system to get new data from the DNS server, which can fix problems caused by corrupted or outdated records.
It also helps protect against DNS spoofing. In some cases, attackers can manipulate cached DNS data to redirect you to malicious websites. Flushing the cache removes any tampered entries and restores accurate information.
If you’ve switched to a new DNS provider or recently updated your website’s DNS settings, your system might still rely on old data. Clearing the cache helps your device fetch the latest records, helping websites load correctly and speeding up DNS propagation.
How often should I flush my DNS cache?
You don’t need to flush your DNS cache regularly since it clears itself automatically after a set period. However, it’s a helpful step when you’re troubleshooting website issues, switching DNS providers, or updating domain settings.

Is It safe to flush DNS cache?
Flushing DNS cache is a simple and risk-free way to fix common website issues by removing outdated or incorrect data from your system’s temporary storage. This forces your device to request fresh information from the DNS server.
Some web browsers store their own DNS cache, so it’s useful to know how to clear it on your operating system and browser. Flushing at the system level usually requires administrator access, while doing it on a browser is more straightforward ‒ just a button click on a DNS management page.
When done correctly, deleting DNS cache can help websites load properly, protect against DNS spoofing, and speed up DNS propagation after changes.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.
Comments
May 13 2018
To check DNS and IP addresses accessed by Chrome, you can go to: chrome://net-internals/#dns
May 23 2018
Hello, Cesar I appreciate your input. I was not aware of the provided tool and it seems really useful!
July 02 2021
Hello : The article was very good and ilustrative , I didn't know that flushing the cache , prevents to several problems from attacks and stole our credentials. Every day we learn something interesting !! Thank you
January 16 2022
DNS_PROBE_FINISHED_NXDOMAIN I request u to do from your team pls fix it
January 18 2022
Hi there, feel free to check our guide on solving DNS_PROBE_FINISHED_NXDOMAIN error. If you're having any trouble with it, don't hesitate to contact your host - in case you're hosting with Hostinger, you can find how to contact the Customer Success team here :)