How to flush dns
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 (Domain Name System) acts like a phonebook for the internet, translating human-readable domain names into IP addresses.
- Your computer or router stores a local cache of DNS records to speed up subsequent lookups.
- A DNS cache flush removes these stored records, forcing your system to query a DNS server for fresh information.
- This process can take less than a minute on most operating systems.
- Common reasons to flush DNS include inability to access websites, incorrect website loading, or after network configuration changes.
What is DNS and Why Cache It?
The internet relies on the Domain Name System (DNS) to function smoothly. When you type a website address, like www.example.com, into your browser, your computer needs to know the specific numerical IP address (e.g., 192.0.2.1) that corresponds to that name. DNS servers handle this translation. To make this process faster and more efficient, your operating system and even your router often store a temporary record of recently visited domain names and their corresponding IP addresses. This is known as the DNS cache.
Imagine it like having a speed dial on your phone. Instead of looking up every contact's number in the main phone book every time, you have frequently called numbers readily available. Similarly, the DNS cache allows your computer to quickly retrieve the IP address for a website it has visited before, without needing to ask a DNS server each time. This significantly speeds up web browsing.
Why Would You Need to Flush Your DNS Cache?
While the DNS cache is beneficial for speed, it can sometimes become outdated or corrupted. This can lead to various connectivity issues:
- Website Inaccessibility: If the IP address for a website has changed and your cache still holds the old information, you might be unable to connect to the site. Your browser will try to reach the old, non-existent IP address.
- Incorrect Website Loading: Sometimes, a website might load with errors or display content from an old version if the cached DNS record points to an outdated server.
- Network Configuration Changes: If you've recently changed your internet service provider (ISP), switched DNS servers, or reconfigured your home network, flushing the DNS cache ensures your system starts using the new network settings.
- Malware or DNS Hijacking: In rare cases, malicious software might alter your DNS cache to redirect you to fake websites (phishing sites). A flush can help clear such malicious entries.
- Troubleshooting Connectivity: It's a common first step in troubleshooting general internet connectivity problems.
Essentially, flushing the DNS cache forces your computer to go back to the DNS servers and get the most up-to-date IP address information for the websites you are trying to visit.
How to Flush Your DNS Cache
The process for flushing the DNS cache varies slightly depending on your operating system. Here are the common methods:
Windows
- Open Command Prompt as Administrator: Search for 'cmd' in the Windows search bar, right-click on 'Command Prompt', and select 'Run as administrator'.
- Enter the Command: In the command prompt window, type the following command and press Enter:
ipconfig /flushdns - Confirmation: You should see a message confirming that the DNS Resolver Cache was successfully flushed.
macOS
- Open Terminal: Go to Applications > Utilities > Terminal.
- Enter the Command: The command depends on your macOS version. For most recent versions (macOS Sierra and later), use:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Press Enter. - Enter Password: You will be prompted to enter your administrator password. Type it in (you won't see characters appear on screen) and press Enter.
Linux
Linux distributions handle DNS caching differently, often through services like systemd-resolved or nscd. The most common methods include:
- For systemd-resolved:
sudo systemd-resolve --flush-caches - For nscd:
sudo /etc/init.d/nscd restart - Note: Some Linux systems might not have a persistent DNS cache enabled by default or might use different service names. Consult your distribution's documentation if the above commands don't work.
Routers
Some home routers also maintain their own DNS cache. To flush your router's DNS cache, you typically need to restart the router. This usually involves unplugging the router's power for about 30 seconds and then plugging it back in.
When Should You Flush DNS?
You don't need to flush your DNS cache regularly. It's a troubleshooting step. Consider flushing your DNS cache if you encounter any of the following:
- You cannot access a website that you know is online.
- A website is not loading correctly or is showing outdated information.
- You have recently made changes to your network settings or ISP.
- You suspect potential DNS-related security issues.
After flushing your DNS cache, it's a good idea to clear your browser's cache as well, just in case the browser itself is holding onto old data.
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
Missing an answer?
Suggest a question and we'll generate an answer for it.