How to Flush DNS Cache on Windows 11/10, macOS, Linux & Chrome (Step-by-Step)
Learn how to flush your DNS cache on Windows 11/10, macOS, Linux, and Chrome. Step-by-step terminal commands to fix DNS_PROBE_FINISHED_NXDOMAIN and resolve stale IP lookups.
Whenever you switch to a faster DNS resolver, migrate a website to a new hosting server, or encounter dreaded browser errors like DNS_PROBE_FINISHED_NXDOMAIN or ERR_NAME_NOT_RESOLVED, your operating system’s local DNS cache is usually the culprit. In this comprehensive guide, we provide the exact terminal commands and step-by-step instructions to flush your DNS cache across Windows 11, Windows 10, macOS, Linux, and web browsers.
1. What Is the DNS Cache and Why Should You Flush It?
To speed up daily web browsing, your operating system and web browser save a temporary memory log of every domain name you visit alongside its resolved IP address. This internal record is called the DNS cache.
When you open a website, your computer checks its local DNS cache first. If a record exists and its Time to Live (TTL) hasn't expired, your machine uses that saved IP address immediately without querying your configured DNS resolver.
However, problems arise when:
- You Switch DNS Resolvers: After changing your router or PC settings to Cloudflare (1.1.1.1) or Google (8.8.8.8), your OS will continue using cached IP records until the cache is cleared.
- A Website Changes IP Addresses: If a web server changes IP addresses or migrates to a new CDN, your browser may keep attempting to connect to the outdated IP, resulting in 404 or connection timeout errors.
- DNS Cache Poisoning / Spoofing: If an untrusted Wi-Fi network inserts corrupt DNS records, flushing the cache forces your device to fetch clean records from your trusted secure resolver.
2. How to Flush DNS on Windows 11 and Windows 10
Flushing your DNS cache on Windows takes less than 10 seconds using the Command Prompt or PowerShell:
- Click the Start button or press Win + S, then type
cmd. - Right-click Command Prompt and select Run as administrator (or open PowerShell).
- In the command prompt window, type the following command and press Enter:
ipconfig /flushdns - Windows will immediately return a confirmation message:
Windows IP Configuration Successfully flushed the DNS Resolver Cache. - (Optional) If you also want to release and renew your dynamic DHCP lease, run:
ipconfig /release ipconfig /renew ipconfig /registerdns
3. How to Flush DNS on macOS (Tahoe, Sonoma, Ventura, Monterey)
On Apple macOS, the local DNS cache is managed by the mDNSResponder daemon. The flush command requires superuser privileges:
- Press Cmd + Space to open Spotlight, type
Terminal, and press Enter. - Copy and paste the command for your macOS version and press Enter:
For macOS Sonoma (14.x), Ventura (13.x), and Monterey (12.x):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Type your Mac login password when prompted (the terminal will not show asterisks while typing for security) and press Enter.
- macOS will not display a success message; returning to a clean prompt indicates that
mDNSResponderhas successfully reloaded and flushed all cached records.
4. How to Flush DNS on Linux (Ubuntu, Debian, Fedora, Arch)
Unlike Windows and macOS, different Linux distributions manage local DNS caching through different services (most commonly systemd-resolved):
A. Ubuntu & Modern systemd-resolved Distros
Open a terminal and run the modern resolvectl command:
sudo resolvectl flush-caches
On older Ubuntu versions (18.04 – 20.04), use the legacy command:
sudo systemd-resolve --flush-caches
To verify that the cache size is now zero, inspect statistics:
resolvectl statistics
B. Dnsmasq
If your system utilizes dnsmasq, send a restart signal:
sudo systemctl restart dnsmasq
C. Name Service Cache Daemon (nscd)
If your distribution runs nscd, restart the daemon:
sudo systemctl restart nscd
5. How to Clear the DNS Cache Inside Your Web Browser
Did you know modern web browsers maintain an independent internal DNS cache completely separate from your operating system? If you flush your OS cache but a website still won't load, clear your browser's internal DNS socket pool:
Google Chrome & Brave Browser
- In Chrome's address bar, paste:
chrome://net-internals/#dnsand press Enter. - Click the Clear host cache button.
- Next, navigate to
chrome://net-internals/#socketsand click Flush socket pools.
Microsoft Edge
- In Edge's address bar, paste:
edge://net-internals/#dnsand press Enter. - Click the Clear host cache button.
Mozilla Firefox
- In Firefox's address bar, paste:
about:networking#dnsand press Enter. - Click the Clear DNS Cache button.
6. Next Steps: Verify Your Active DNS and Test Latency
After flushing your DNS cache, verify that your network is routing through your desired provider and check its responsiveness:
- Check Which DNS You Are Actually Using: Run our What Is My DNS Server Diagnostic Tool to inspect your upstream resolver IP and ISP routing.
- Ensure You Have No Leaks: If you use a VPN or encrypted proxy, run the DNS Leak Test to ensure your unencrypted ISP resolver isn't snooping on your browsing.
- Benchmark Speed: Test your new resolver's round-trip response time with our free Fastest DNS Speed Test.