When you navigate the web, your computer does not query remote DNS servers for every single image, script, and link you open. To speed up browsing and reduce network traffic, your operating system maintains a temporary local database in RAM called the DNS Client Resolver Cache. However, when websites migrate to new hosting servers, when CDN IP addresses rotate, or when your ISP's DNS becomes corrupted, stale local cache records cause agonizing website loading delays, SSL certificate mismatches, and 404 Not Found errors. Running the Flush DNS command instantly purges corrupted cache. Here is the complete technical guide.
How Local DNS Resolver Caching Works (The TTL Timer)
When you visit a domain (e.g. dcspeedtest.com), your computer queries your DNS resolver (such as Cloudflare 1.1.1.1). The authoritative name server returns the IP address along with a Time-to-Live (TTL) value (typically 300 to 86,400 seconds). Your operating system saves this record in local memory:
- For the next 300 seconds, any app on your PC accessing that domain reads the IP from local RAM in 0.0 milliseconds without touching the internet.
- If the website changes its server IP before your local TTL timer expires, your PC continues sending packets to the dead old IP, resulting in browser timeout errors.
Step-by-Step Guide: How to Flush DNS on Any Operating System
1. Windows 11 & Windows 10
- Press
Win + S, type cmd, right-click Command Prompt, and select Run as Administrator. - Type the following command and press Enter:
ipconfig /flushdns - Windows will immediately display: "Successfully flushed the DNS Resolver Cache."
- Optional Power Tweak: To view your active cache before flushing, type
ipconfig /displaydns.
2. macOS (Sonoma, Ventura, Monterey)
- Open Terminal (via Spotlight by pressing
Cmd + Spaceand typing Terminal). - Type the following command and press Enter (enter your Mac administrator password when prompted):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Your Mac will silently restart the background DNS daemon with a clean cache.
3. Linux (Ubuntu, Debian, Fedora with systemd-resolved)
sudo systemd-resolve --flush-caches
sudo resolvectl flush-caches
Flushing Web Browser Internal DNS Caches
Modern Chromium web browsers (Google Chrome, Microsoft Edge, Brave) maintain their own internal secondary DNS cache independent of the operating system:
- In Google Chrome, type
chrome://net-internals/#dnsinto your address bar and click Clear host cache. - In Microsoft Edge, type
edge://net-internals/#dnsand click Clear host cache.
Understanding Negative Caching and NXDOMAIN Persistence
One of the most frustrating aspects of local DNS caching is Negative Caching (RFC 2308). When you attempt to open a new website while your router or internet connection is momentarily offline, your operating system receives or records an NXDOMAIN (Non-Existent Domain) failure in local cache.
Even after your internet connection is fully restored, Windows may continue returning that cached NXDOMAIN error for up to 15 minutes, blocking you from visiting the site until the negative cache timer expires. Running ipconfig /flushdns immediately wipes all negative cache records, restoring instant browsing access.
Advanced Troubleshooting: Combining Flush DNS with Winsock and IP Reset
If flushing DNS alone does not resolve your network connectivity or website loading issues, execute this full network stack refresh script in Windows Command Prompt as Administrator:
ipconfig /flushdns
ipconfig /registerdns
ipconfig /release
ipconfig /renew
netsh winsock reset
netsh int ip reset
Restart your PC after running these commands to completely reset the Windows TCP/IP networking stack and clear all corrupt socket bindings.
Summary Checklist: When to Flush DNS
| Troubleshooting Scenario | Why Flushing DNS Fixes It |
|---|---|
| Switched Router to Cloudflare (1.1.1.1) | Forces immediate adoption of new ultra-fast Anycast resolvers |
| Website Shows 'Server IP Address Could Not Be Found' | Purges stale NXDOMAIN negative caching records |
| Minecraft / Game Server Cannot Resolve Hostname | Fetches updated SRV records immediately |
Understanding DNS Cache Poisoning & Threat Sanitization
In addition to fixing stale records, flushing DNS is a vital cybersecurity hygiene practice. If your computer connects to an untrusted public Wi-Fi network (such as at a hotel or coffee shop) where a malicious actor has attempted ARP spoofing or DNS poisoning to inject fake banking IP addresses into your cache, running ipconfig /flushdns purges the compromised entries immediately.
Diagnostic Verification: Checking Cache Status in PowerShell
To inspect specific domain entries in your local Windows DNS cache before and after flushing, open PowerShell and execute:
Get-DnsClientCache | Format-Table -AutoSize
Clear-DnsClientCache
This provides an instant visual confirmation that all local hostname records have been cleared from RAM.
Why DNS Cache Poisoning Is More Dangerous on Public Wi-Fi
On open public Wi-Fi networks in airports and hotels, malicious actors on the same local subnet can execute ARP Spoofing attacks to impersonate the local router and inject fraudulent IP addresses directly into your computer's DNS cache. If your computer caches a poisoned DNS record, your browser will silently send login credentials to an attacker's phishing server.
Whenever you disconnect from public Wi-Fi, running ipconfig /flushdns on Windows or sudo dscacheutil -flushcache on Mac completely purges all untrusted temporary hostname records from system memory, keeping your personal credentials secure.
Automating DNS Cache Flushing via Batch Scripts
For IT administrators and gamers who want a 1-click desktop shortcut to flush DNS, create a simple batch file on your desktop named FlushDNS.bat containing:
@echo off
ipconfig /flushdns
echo DNS Resolver Cache Cleared Successfully!
pause
Right-click the file and select Run as Administrator whenever websites fail to load.
Summary: The Power of a Clean DNS Resolver Cache
In summary, flushing your DNS cache is one of the fastest, safest, and most effective network troubleshooting steps you can perform. By clearing out expired, corrupt, or poisoned hostname mappings, you force your computer to establish fresh, ultra-fast connections to your configured DNS servers, ensuring instant web page loading and zero domain resolution errors.
Testing DNS Resolution Speeds Before and After Flushing
To verify that your DNS resolution latency has dropped after flushing cache and configuring new resolvers, run a live line audit on our free DCSpeedTest Live Testing Engine to measure your active lookup response times across global edge networks.
By keeping your local resolver cache clean and flushed, you guarantee smooth, unthrottled internet browsing and instant connection to your favorite gaming servers.