How to Flush Your DNS Cache
Step-by-step instructions to flush your DNS cache on Windows, macOS, Linux, and Chrome. Learn why and when to clear your DNS cache.
Flushing your DNS cache clears the locally stored DNS records on your device, forcing it to fetch fresh results from DNS servers. This is one of the first troubleshooting steps when a website isn't loading correctly or when you've recently made DNS changes.
Why Flush Your DNS Cache
Your operating system caches DNS lookups to speed up repeat visits. But this cache can become stale or incorrect:
- After changing DNS records β you updated an A record or switched nameservers, but your browser still shows the old IP
- After a DNS migration β you moved to a new DNS provider like DNScale and want to verify the change immediately
- Website not loading β the cached record points to a server that's no longer responding
- DNS poisoning concerns β a corrupted cache entry is returning the wrong IP address
- Troubleshooting connectivity β ruling out stale DNS as the cause of network issues
Flush DNS on Windows
Windows 10 / 11
Open Command Prompt or PowerShell as Administrator:
ipconfig /flushdnsYou'll see: Successfully flushed the DNS Resolver Cache.
To verify the cache is empty:
ipconfig /displaydnsReset the DNS Client Service
If flushing alone doesn't work:
net stop dnscache
net start dnscacheFlush DNS on macOS
The command varies by macOS version, but this works on macOS Monterey and later (including Ventura, Sonoma, and Sequoia):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderEnter your admin password when prompted. There's no confirmation message β the command completes silently.
Older macOS Versions
| Version | Command |
|---|---|
| Big Sur / Monterey+ | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| Catalina | sudo killall -HUP mDNSResponder |
| Mojave | sudo killall -HUP mDNSResponder |
| High Sierra | sudo killall -HUP mDNSResponder |
| Sierra | sudo killall -HUP mDNSResponder |
| El Capitan | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
Flush DNS on Linux
Linux distributions vary in their DNS caching behavior. Many don't cache DNS by default, but if you use systemd-resolved, dnsmasq, or nscd, here's how to clear them:
systemd-resolved (Ubuntu 18.04+, Fedora, Arch)
sudo systemd-resolve --flush-cachesOr on newer versions:
sudo resolvectl flush-cachesVerify with:
resolvectl statisticsdnsmasq
sudo systemctl restart dnsmasqnscd (Name Service Cache Daemon)
sudo systemctl restart nscdOr invalidate just the hosts cache:
sudo nscd -i hostsFlush DNS in Chrome
Chrome maintains its own internal DNS cache, separate from the OS cache. To clear it:
- Open Chrome and navigate to:
chrome://net-internals/#dns - Click Clear host cache
- Optionally, also go to
chrome://net-internals/#socketsand click Flush socket pools
Other Browsers
- Firefox: No built-in DNS cache flush. Restart the browser, or set
network.dnsCacheExpirationto0inabout:config - Safari: Enable Develop menu (Preferences β Advanced), then Develop β Empty Caches
- Edge: Same as Chrome β navigate to
edge://net-internals/#dns
When to Flush vs. When to Wait
| Scenario | Action |
|---|---|
| Changed DNS records, want to verify now | Flush your cache |
| Changed DNS records, can wait | Let TTL expire naturally |
| Website not loading, works for others | Flush your cache |
| DNS migration in progress | Flush after confirming changes with dig |
| Regular browsing | No need to flush |
Verify DNS Changes Without Flushing
Instead of flushing your cache, you can query a DNS server directly to check if your changes have propagated:
# Query Google's public DNS
dig example.com @8.8.8.8
# Query Cloudflare's DNS
dig example.com @1.1.1.1
# Query your DNScale nameserver directly
dig example.com @ns1.dnscale.euThis bypasses your local cache entirely and shows what DNS servers are currently returning.
Understanding DNS Cache TTL
DNS caching is controlled by the TTL (Time to Live) value set on each record. When you flush your cache, you're clearing entries before their TTL expires.
Pro tip: If you plan to make DNS changes, lower the TTL to 300 seconds (5 minutes) a day before the change. After the change propagates, restore the original TTL. This minimizes the window where stale records are served. See DNS TTL Best Practices for more strategies.
Related Topics
- What Is TTL β how cache duration works in DNS
- DNS TTL Best Practices β recommended TTL strategies
- DNS Propagation Explained β why DNS changes take time
Conclusion
Flushing your DNS cache is a quick, safe operation that forces your device to fetch fresh DNS data. Whether you're troubleshooting connectivity issues or verifying DNS changes after updating records in DNScale, it's an essential tool in every administrator's toolkit.