How to Flush DNS Cache — Clear DNS on Windows, Mac, Linux & Browsers
Last Updated: October 2026
Key Takeaways
- ✓ Your DNS cache stores recent domain-to-IP lookups. When entries go stale, websites may fail to load or resolve to the wrong server.
- ✓ Windows: Open Command Prompt as Administrator and run
ipconfig /flushdns. - ✓ macOS: Run
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderin Terminal. - ✓ Linux: Run
sudo systemd-resolve --flush-cacheson systemd-based distributions. - ✓ Browsers have their own DNS cache — clear Chrome's at
chrome://net-internals/#dns. - ✓ Flushing DNS is safe, quick, and causes no data loss. It's the first step in troubleshooting most DNS-related issues.
What Is a DNS Cache?
Every time you visit a website, your device queries a DNS (Domain Name System) server to translate the domain name — like example.com — into an IP address like 93.184.216.34. This process typically takes 10–50 ms. To avoid repeating this lookup on every request, your operating system stores the result in a local DNS cache — a temporary database in memory that maps domain names to their resolved IP addresses.
Each cached entry includes a TTL (Time To Live) value, set by the domain's DNS administrator, that tells your system how long to keep the record before discarding it and fetching a fresh one. TTL values typically range from 300 seconds (5 minutes) to 86,400 seconds (24 hours). Until the TTL expires, your device uses the cached IP address without contacting any DNS server.
Your DNS cache operates on multiple levels simultaneously:
- Browser cache: Chrome, Firefox, Edge, and Safari each maintain their own internal DNS cache. Chrome, for instance, caches up to 1,000 DNS entries for up to 60 seconds by default.
- Operating system cache: Windows, macOS, and Linux all maintain a system-wide DNS cache that all applications share. This is the cache you flush with commands like
ipconfig /flushdns. - Router cache: Many home routers cache DNS results as well, serving as a local DNS forwarder for all devices on the network.
- ISP resolver cache: Your ISP's DNS server also caches results for all its customers. You cannot flush this cache directly.
Why Would You Need to Flush Your DNS Cache?
Under normal conditions, the DNS cache works invisibly and correctly. However, several situations require you to manually clear it:
1. Website Recently Changed Servers
When a website migrates to a new hosting provider or CDN, its IP address changes. If your DNS cache still holds the old IP (and the TTL hasn't expired), your browser connects to the old server — which may show an error, a parking page, or the old version of the site. Flushing forces a fresh lookup that returns the new IP address.
2. You Changed Your DNS Server
After switching from your ISP's DNS to a public resolver like 1.1.1.1 or 8.8.8.8, your cache still contains entries resolved by the old server. Flushing clears them so all new queries go through your chosen DNS provider. This is especially important if you're switching DNS to fix a resolution problem.
3. DNS Resolution Errors
If you see errors like DNS_PROBE_FINISHED_NXDOMAIN, ERR_NAME_NOT_RESOLVED, or "This site can't be reached," a corrupted or incorrect DNS cache entry may be the cause. Browsers sometimes cache negative responses (NXDOMAIN) too — meaning if a DNS lookup failed once, the failure itself is cached, and your browser won't retry until the negative cache expires. Flushing forces an immediate retry.
4. Security Concerns (DNS Cache Poisoning)
DNS cache poisoning (also called DNS spoofing) is an attack where a malicious actor injects fraudulent DNS records into your cache, redirecting you to phishing or malware sites when you type a legitimate domain. While modern DNS resolvers have protections against this (DNSSEC, source port randomization), flushing your cache is a prudent step if you suspect your DNS has been tampered with — for example, after connecting to an untrusted public Wi-Fi network.
5. Development and Testing
Web developers frequently need to flush DNS when testing domain configurations, SSL certificates, or server migrations. After updating DNS records, the old cached entries prevent you from verifying the change until you flush.
How to Flush DNS Cache on Windows
The process is the same on Windows 10 and Windows 11. You need an elevated Command Prompt or PowerShell:
Method 1: Command Prompt
- Press
Win + Sand type cmd. - Right-click Command Prompt and select Run as administrator.
- Type the following command and press Enter:
ipconfig /flushdns - You should see: "Successfully flushed the DNS Resolver Cache."
Method 2: PowerShell
- Press
Win + Xand select Terminal (Admin) or Windows PowerShell (Admin). - Run:
Clear-DnsClientCache - PowerShell won't show a confirmation message, but the cache is cleared.
Verifying the Flush on Windows
To confirm the cache is empty, run:
ipconfig /displaydns— This displays all current DNS cache entries. Immediately after flushing, it should show very few or no entries.- After the flush, visit a website and run
ipconfig /displaydnsagain — you should see a fresh entry for that domain with a current TTL.
Additional Windows Network Reset Commands
If flushing DNS alone doesn't solve the problem, these related commands can help:
ipconfig /release— Releases your current DHCP-assigned IP address.ipconfig /renew— Requests a new IP address from the DHCP server.netsh winsock reset— Resets the Winsock catalog to its default configuration. Useful when network-related software has corrupted socket settings.netsh int ip reset— Resets the TCP/IP stack. Requires a restart to take full effect.
Running all four commands in sequence followed by a restart is the "nuclear option" for Windows network issues and resolves most DNS and connectivity problems.
How to Flush DNS Cache on macOS
macOS uses the mDNSResponder daemon for DNS resolution. The flush command has remained consistent across recent macOS versions (Ventura, Sonoma, Sequoia):
- Open Terminal (Applications → Utilities → Terminal, or press
Cmd + Spaceand type "Terminal"). - Run the following command:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Enter your administrator password when prompted.
- There is no confirmation message — if no error appears, the cache was flushed successfully.
What Each Part Does
dscacheutil -flushcache— Flushes the directory service cache, which includes DNS entries.killall -HUP mDNSResponder— Sends a "hang up" signal to the mDNSResponder process, forcing it to restart and clear its internal cache.
macOS Version-Specific Commands
The command above works on macOS Monterey (12) and later. For reference, older versions used different commands:
- macOS Big Sur (11) and Catalina (10.15): Same command —
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - macOS Mojave (10.14) and High Sierra (10.13): Same command.
- macOS Sierra (10.12) and El Capitan (10.11): Same command.
- OS X Yosemite (10.10):
sudo discoveryutil udnsflushcaches
If you're unsure which macOS version you're running, click the Apple menu → About This Mac.
How to Flush DNS Cache on Linux
Linux DNS caching depends on which DNS caching daemon your distribution uses. Most modern distributions use systemd-resolved, but some use nscd or dnsmasq.
systemd-resolved (Ubuntu 18.04+, Fedora, Arch, Pop!_OS)
- Open a terminal.
- Run:
sudo systemd-resolve --flush-caches
Or on newer systemd versions:sudo resolvectl flush-caches - Verify by checking cache statistics:
sudo systemd-resolve --statistics
The "Current Cache Size" should be 0 immediately after flushing.
nscd (Name Service Cache Daemon)
Some distributions (particularly RHEL/CentOS and older setups) use nscd:
- Restart the daemon:
sudo systemctl restart nscd - Or invalidate just the hosts cache:
sudo nscd -i hosts
dnsmasq
If your system uses dnsmasq as a local DNS cache (common in some NetworkManager configurations):
- Restart the service:
sudo systemctl restart dnsmasq
No Caching Daemon Installed
Some minimal Linux installations (particularly servers) do not run any DNS caching daemon at all. In this case, there is no local cache to flush — every DNS query goes directly to the configured nameserver. You can verify by running systemctl list-units | grep -E '(resolved|nscd|dnsmasq)'. If none of these services appear, you don't need to flush anything locally.
How to Clear DNS Cache in Web Browsers
Browsers maintain their own DNS cache independently of the operating system. Even after flushing the system cache, the browser's internal cache may still hold old entries. You need to clear both for a complete flush.
Google Chrome (and Chromium-based browsers)
- Open Chrome and type
chrome://net-internals/#dnsin the address bar. - Click the Clear host cache button.
- Optionally, also go to
chrome://net-internals/#socketsand click Flush socket pools to close any existing connections that might be using cached DNS results.
This same method works in Microsoft Edge (use edge://net-internals/#dns), Brave (use brave://net-internals/#dns), and other Chromium-based browsers.
Mozilla Firefox
- Type
about:networking#dnsin Firefox's address bar. - Click Clear DNS Cache.
Firefox also caches DNS internally when using DNS-over-HTTPS (DoH). If DoH is enabled, clearing the cache here also clears DoH-resolved entries. You can check DoH status in Settings → search for DNS → DNS over HTTPS.
Microsoft Edge
- Navigate to
edge://net-internals/#dns. - Click Clear host cache.
- Optionally flush sockets at
edge://net-internals/#sockets.
Safari (macOS)
- Enable the Develop menu: Safari → Settings → Advanced → check Show features for web developers.
- Go to Develop → Empty Caches.
Safari does not expose a dedicated DNS cache clear option. Clearing caches via the Develop menu and flushing the macOS system DNS cache together is the recommended approach.
How to Verify the DNS Cache Was Flushed
After flushing, you want to confirm it actually worked. Here are verification methods for each platform:
Windows
- Run
ipconfig /displaydnsin an elevated Command Prompt. The output should be empty or contain only a few entries that were cached in the seconds since you flushed. - Visit a website, then run the command again — you should see a brand-new entry with a full TTL value.
macOS
- macOS does not have a built-in command to display the DNS cache contents. The best verification is to run
nslookup example.combefore and after flushing and check that the query time increases after the flush (indicating a fresh lookup rather than a cached response). - You can also use
sudo killall -INFO mDNSResponderand check the system log (log show --predicate 'process == "mDNSResponder"' --last 1m) for cache statistics.
Linux (systemd-resolved)
- Run
sudo systemd-resolve --statistics(orresolvectl statistics). - Check the "Current Cache Size" field — it should be 0 immediately after flushing.
- After visiting a few websites, the cache size will increase again, confirming the system is caching fresh results.
You can also use our DNS Lookup tool to perform a DNS query from our servers. If our tool returns a different IP than what your browser is using, your local cache is likely stale and needs flushing.
When Flushing DNS Doesn't Help
Flushing DNS is a targeted fix for cache-related problems. If it doesn't resolve your issue, the problem lies elsewhere:
DNS Server Itself Is Down
If your configured DNS server is unreachable, no amount of cache flushing will help — there's no server to fetch fresh records from. Test by running nslookup example.com 1.1.1.1. If this works but nslookup example.com (using your default server) fails, switch your DNS server. See our How to Fix DNS Server Not Responding guide for detailed steps.
Domain Doesn't Exist or Has Expired
If a domain has genuinely expired or was never registered, DNS will correctly return NXDOMAIN (no such domain). Flushing won't change this — the domain simply doesn't exist in the global DNS system. Verify by looking up the domain on a WHOIS service.
DNS Propagation Is Still In Progress
When a domain's DNS records are changed, the update can take up to 24–48 hours to propagate to all DNS servers worldwide. During this period, some DNS servers may return the old IP while others return the new one. Flushing your local cache may help you pick up the new record sooner, but if the upstream DNS server your resolver queries hasn't updated yet, you'll still get the old record.
Firewall or Security Software Blocking DNS
Antivirus programs, firewalls, and VPN software can intercept DNS queries and return unexpected results. If DNS issues persist after flushing, try temporarily disabling security software to isolate the cause. Corporate VPNs are a common culprit — they often route DNS through the company's internal resolvers, which may not resolve public domains correctly.
Hosts File Override
Your operating system's hosts file overrides DNS entirely for entries it contains. If a domain is defined in the hosts file, DNS is never queried for it, and flushing the cache has no effect. Check:
- Windows:
C:\Windows\System32\drivers\etc\hosts - macOS / Linux:
/etc/hosts
Remove any entries for the domain you're having trouble with, then flush the DNS cache and try again.
Router DNS Cache
Your home router may have its own DNS cache that persists even after you flush the cache on your device. To clear the router's cache, restart the router by unplugging it for 30 seconds and plugging it back in. Some routers also have a "Clear DNS Cache" option in their admin panel under the DNS or maintenance settings.
Automating DNS Cache Flushes
If you find yourself flushing DNS frequently (common during development or DNS migrations), you can automate the process:
Windows: Create a Batch File
Create a file called flush-dns.bat with the following content:
@echo offipconfig /flushdnsecho DNS cache flushed.pause
Right-click and Run as administrator whenever you need a quick flush.
macOS / Linux: Create a Shell Alias
Add the following line to your ~/.zshrc (macOS) or ~/.bashrc (Linux):
- macOS:
alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; echo "DNS cache flushed"' - Linux (systemd):
alias flushdns='sudo systemd-resolve --flush-caches && echo "DNS cache flushed"'
After saving and running source ~/.zshrc (or source ~/.bashrc), you can type flushdns in any terminal to instantly clear the cache.
DNS Cache and Security: What You Should Know
Your DNS cache can be both a security asset and a vulnerability. Understanding the security implications helps you make informed decisions about when and how often to flush.
DNS Cache Poisoning Attacks
In a cache poisoning attack, an attacker sends forged DNS responses to your resolver, replacing legitimate IP addresses with malicious ones. If the forged response is cached, every subsequent request for that domain goes to the attacker's server. This enables phishing, credential theft, and malware distribution. Modern DNS servers mitigate this with DNSSEC (cryptographic DNS signing), source port randomization, and query ID randomization, but the risk isn't zero.
Public Wi-Fi Risks
When you connect to public Wi-Fi (coffee shops, airports, hotels), the network's DNS server may inject or alter DNS responses for tracking, advertising, or content filtering. These altered records get cached on your device. After disconnecting from an untrusted network, it's good practice to flush your DNS cache and verify your DNS settings haven't been changed.
Using DNSSEC and Encrypted DNS
The most effective protection against DNS tampering is using DNS-over-HTTPS (DoH) or DNS-over-TLS (DoT) with a provider that supports DNSSEC validation. This ensures your DNS queries are encrypted in transit and that the responses are cryptographically verified. Cloudflare (1.1.1.1), Google (8.8.8.8), and Quad9 (9.9.9.9) all support both encrypted DNS and DNSSEC.
Frequently Asked Questions
What is a DNS cache?
A DNS cache is a temporary database on your device that stores recent DNS lookups (domain name to IP address mappings). It speeds up browsing by skipping the DNS server query for domains you've visited recently. Cached entries expire based on their TTL (Time To Live) value, but they can become stale if a website changes its IP address before the TTL expires.
How do I flush DNS cache on Windows?
Open Command Prompt as Administrator and run ipconfig /flushdns. You'll see "Successfully flushed the DNS Resolver Cache." Alternatively, open PowerShell as Administrator and run Clear-DnsClientCache.
How do I flush DNS cache on macOS?
Open Terminal and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Enter your admin password when prompted. This works on macOS Ventura, Sonoma, Sequoia, and all modern versions.
How do I flush DNS cache on Linux?
On distributions using systemd-resolved (Ubuntu, Fedora, Arch, Pop!_OS), run sudo systemd-resolve --flush-caches or sudo resolvectl flush-caches. Verify with sudo systemd-resolve --statistics to confirm the cache size is zero.
How do I clear the DNS cache in Chrome?
Navigate to chrome://net-internals/#dns and click Clear host cache. For a complete flush, also go to chrome://net-internals/#sockets and click Flush socket pools. This works in all Chromium-based browsers (Edge, Brave, etc.) using their respective URL prefixes.
How often should I flush my DNS cache?
You don't need to flush DNS on a schedule. Do it when you have specific symptoms: websites not loading that work for others, DNS resolution errors, seeing an old version of a recently migrated site, or after changing your DNS server settings. There's no harm in flushing, but it provides no benefit if your cache isn't the problem.
Will flushing DNS fix my internet connection?
Only if the problem is caused by stale or corrupted DNS cache entries. Flushing DNS will not fix network connectivity issues, ISP outages, DNS server failures, Wi-Fi problems, or issues unrelated to DNS. If flushing doesn't help, see our DNS Server Not Responding guide for more comprehensive troubleshooting.
What happens when I flush my DNS cache?
All stored domain-to-IP mappings are deleted from memory. The next time you visit any website, your device performs a full DNS lookup from scratch. The first visit to each site may take 10–50 ms longer, but subsequent visits are cached normally again. No personal data, passwords, cookies, or browsing history is affected.