How to dns flush
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 4, 2026
Key Facts
- DNS cache stores recent website IP address lookups.
- Flushing the DNS cache forces your computer to re-query DNS servers.
- This process can resolve issues with accessing websites or online services.
- The command to flush DNS is typically `ipconfig /flushdns` on Windows.
- macOS and Linux systems use different commands, like `sudo killall -HUP mDNSResponder` or `sudo systemd-resolve --flush-caches`.
What is DNS and Why Does it Need Flushing?
The Domain Name System (DNS) acts like the internet's phonebook. When you type a website address (like www.google.com) into your browser, your computer needs to find the corresponding numerical IP address (like 172.217.160.142) to connect to the correct server. This translation process is handled by DNS servers. To speed things up and reduce the load on DNS servers, your computer and network devices store a temporary record of these translations in a local cache. This is known as the DNS cache.
While this caching is generally beneficial, it can sometimes lead to problems. If a website's IP address changes, or if there's a temporary issue with a DNS server, your computer might still be using outdated or incorrect information from its cache. This can result in errors like "Page not found," "This site can't be reached," or a website loading incorrectly. Flushing the DNS cache clears out this stored information, forcing your computer to request a fresh, up-to-date DNS record the next time you try to access the website.
How to Flush Your DNS Cache
The process for flushing your DNS cache varies slightly depending on your operating system. In most cases, it involves opening a command-line interface with administrative privileges and entering a specific command.
Windows
For Windows users, flushing the DNS cache is straightforward:
- Open the Command Prompt as an administrator. You can do this by searching for "cmd" in the Start menu, right-clicking on "Command Prompt," and selecting "Run as administrator."
- In the Command Prompt window, type the following command and press Enter:
ipconfig /flushdns - You should see a message confirming that the DNS Resolver cache was successfully flushed.
This command tells the Windows DNS client resolver service to clear its cache.
macOS
On macOS, the command to flush the DNS cache depends on the version of the operating system:
- For macOS Sierra (10.12) and later: Open the Terminal application (Applications > Utilities > Terminal) and enter:
sudo killall -HUP mDNSResponder. You will be prompted for your administrator password. - For older macOS versions (e.g., El Capitan 10.11): The command might be slightly different. For El Capitan, you can use:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
The `mDNSResponder` process handles multicast DNS and is responsible for DNS caching on macOS.
Linux
Linux distributions use different DNS caching services, so the command can vary:
- Systemd-resolved (common in modern distributions like Ubuntu 18.04+, Fedora): Open a terminal and run:
sudo systemd-resolve --flush-caches - Nscd (Name Service Cache Daemon): If your system uses `nscd`, the command is:
sudo /etc/init.d/nscd restart - Dnsmasq: For systems using `dnsmasq`, you might need to restart the service:
sudo service dnsmasq restart
It's important to identify which DNS caching service your specific Linux distribution is using to execute the correct command.
Routers and Other Devices
Some routers also maintain their own DNS cache. If you're experiencing network-wide DNS issues, you might need to restart your router. Check your router's manual or manufacturer's website for specific instructions on how to do this, as it often involves simply unplugging the router, waiting 30 seconds, and plugging it back in.
When Should You Flush Your DNS?
Flushing your DNS is a useful troubleshooting step in several scenarios:
- Website Not Loading: If you're consistently unable to access a specific website, but others can, flushing your DNS might resolve the issue.
- Incorrect Website Version Loading: Sometimes, a site might load an old version of its content due to cached DNS records.
- Network Changes: After making changes to your network configuration or DNS settings, flushing the cache ensures these changes are recognized.
- Malware or DNS Hijacking: In rare cases, malicious software might alter DNS settings. Flushing the cache is a first step in diagnosing such issues.
- Connecting to a New Server: If you've recently moved a website to a new server, flushing DNS helps propagate the new IP address faster.
It's generally not necessary to flush your DNS cache regularly unless you encounter specific problems. Your operating system is designed to manage its cache efficiently.
Potential Side Effects
Flushing your DNS cache is a safe procedure and typically has no negative side effects. The only minor inconvenience is that the first time you visit a website after flushing, it might take slightly longer to load as your computer needs to retrieve the DNS information again. Subsequent visits will be fast as the information is cached again.
More How To in Daily Life
Also in Daily Life
More "How To" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Domain Name System - WikipediaCC-BY-SA-4.0
- How to Flush Your DNS Cache - Cloudflarefair-use
- Using Google Public DNSfair-use
Missing an answer?
Suggest a question and we'll generate an answer for it.