Dec 02, 2024
Aris S.
5min Read
Flushing DNS caches is a quick and easy solution to internet issues like inaccessible websites or 404 errors. It is risk-free and has various additional benefits, including improving security.
In this article, we will explain how to flush DNS on various operating systems and web browsers. Before getting into the steps, you will learn what DNS cache is so you understand how the process can benefit your system.
When you access a website using its URL, like https://hostinger.com/, the domain name system (DNS) server will tell your web browser how to find the site. It does so by giving various information, including the site’s IP address and other DNS records.

Once fetched, details about this URL will remain in your system as a cache. This enables your web browser to retrieve the information locally when you revisit the website instead of retrieving it from the DNS server again, making the process quicker.
However, this DNS cache might become invalid or corrupted, preventing your web browser from properly resolving a URL into its IP address. In this situation, you must delete the DNS cache to force the browser to fetch fresh information.
The steps to flush the DNS cache differ across operating systems. In this section, we will explain how to do so in the three most popular OSes – Windows, macOS, and Linux.
With Windows, the steps to flush DNS will be similar for most versions, especially the newer ones. Here’s how to do so:
Ipconfig /flushdns
That’s it. 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.

If you encounter an error when running the command, make sure to launch Command Prompt as an administrator. Otherwise, you won’t have the necessary permissions to flush the DNS cache.
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:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSRespondersudo killall -HUP mDNSRespondersudo discoveryutil udnsflushcachessudo killall -HUP mDNSRespondersudo dscacheutil -flushcachesudo lookupd -flushcacheCommands to flush DNS caches in Linux differ depending on your distributions 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:
sudo /etc/init.d/dnsmasq restartsudo /etc/init.d/nscd restartsudo /etc/init.d/named restart && sudo rndc restart && sudo rndc execThe 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
Since web browsers typically store their own DNS cache, you might need to flush them separately. Here’s how to do so in some of the most popular browsers:
chrome://net-internals/#dnsedge://net-internals/#dns about:networking#dnsopera://net-internals/#dns
We’re done. 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.
By default, DNS caches will clear themselves after reaching a certain time-to-live (TTL) period. In some cases, however, you might need to manually flush them before they expire. Here are some of the reasons:

Upon visiting a website, your system will save information about its domain as a DNS cache. While useful for speeding up the loading process, you might need to delete this cache since it can get corrupted and cause connectivity issues.
In this article, we have explained how to flush DNS on various operating systems and web browsers. The general procedure is similar, but the command and address differ depending on the software.
To flush your computer’s DNS, open your system’s command-line interface and enter the DNS deletion commands as an administrator. For browsers, open the DNS management page by entering the address into the address bar and clicking the cache deletion option.
Flushing DNS clears corrupted or outdated data in your system to help resolve connectivity issues. Moreover, it prevents spoofing attacks, in which hackers alter your DNS records to redirect you to malicious websites.
Yes, flushing the DNS cache is risk-free. All it does is remove invalid or outdated data to force your system to download the new one.
There is no ideal frequency for flushing your system’s DNS cache. However, since it is beneficial, we recommend doing it regularly, like weekly.
Flushing DNS cache doesn’t directly affect your internet speed. However, it can make websites load slightly slower when you reaccess them again since your web browser must fetch the new DNS information.
Yes, rebooting your system will flush the DNS cache. However, other DNS caches might still exist in other areas, like your web browser or router.
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 :)