How to Flush DNS Cache
Clear local DNS cache so your system stops using stale records and requests fresh DNS information again.
Before you start
When flushing DNS is the right move
Your machine may still be using an older cached IP even though the DNS record has already been updated.
Old DNS cache can send you to the previous server or environment instead of the new one.
Local cached records may still point to an older network path even after infrastructure changes are complete.
If the authoritative records are correct but your own machine still behaves differently, local DNS cache is a likely suspect.
Step-by-step instructions
1. Check the current DNS result first
Before flushing anything, check what IP address your system currently resolves for the domain. This gives you something concrete to compare after the cache is cleared.
nslookup example.com
If the result changes after flushing, you know the old value really was coming from cache or local resolver behavior.
2. Flush DNS on Windows
On Windows, use the built-in command below from Command Prompt. Running it as Administrator is often the cleanest approach.
ipconfig /flushdns
Windows should report that the DNS Resolver Cache was flushed successfully.
3. Flush DNS on macOS
On macOS, the usual command is run through Terminal with sudo.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS versions vary, but this command works in many common modern cases and is a solid first troubleshooting step.
4. Flush DNS on Linux
On Linux, the exact command depends on the resolver service being used. A very common modern setup uses systemd-resolved.
sudo resolvectl flush-caches
If your Linux system is using another resolver such as nscd or dnsmasq, the correct restart or flush method may be different.
5. Run the DNS lookup again after flushing
After the flush, run the same lookup again and compare the result with the value you saw before.
nslookup example.com
If the IP or DNS answer changed to the expected new value, the flush probably resolved the issue.
6. Continue troubleshooting if nothing changes
If the lookup result stays the same, the problem may not be local cache at all. The upstream DNS server, propagation state, or another caching layer may still be the real cause.
At that point, compare results with another DNS server, use nslookup or dig directly, and confirm whether the DNS record has really propagated as expected.
Common mistakes
Without a before-and-after comparison, it is harder to tell whether flushing DNS actually changed anything.
If the DNS server itself still returns old data, flushing your local cache will not magically fix the upstream record.
Linux DNS behavior depends on which resolver service is active, so the correct flush method may differ across systems.
The correct workflow is flush first, then test again immediately so you know whether the DNS answer really changed.
About this guide
This guide shows how to flush DNS cache when a computer keeps using an old IP address, opens the wrong site, or fails to pick up recent DNS changes. It focuses on practical commands for Windows, macOS, and Linux, plus the checks you should do before and after clearing the cache.
How to follow this guide
- Confirm the issue looks like a DNS cache problem before clearing anything.
- Run the correct flush command for Windows, macOS, or Linux.
- Repeat the DNS lookup after flushing the cache.
- Compare the new result with the expected IP or hostname.
- If nothing changes, continue with resolver, DNS server, or propagation checks.
Why use this method?
DNS cache problems are common after domain moves, DNS record updates, server migrations, CDN changes, or SSL setup work. Flushing the local cache is often the fastest way to force the system to ask for fresh DNS information instead of reusing an old record.
Frequently Asked Questions
When should I flush DNS cache?
Flush DNS cache when your computer still resolves a domain to an old IP address or continues showing outdated DNS behavior after a recent change.
Does flushing DNS change my DNS server?
No. It only clears the cached local records so the system requests fresh DNS data again.
Why does the problem remain after flushing DNS?
The DNS server itself may still have old data, propagation may still be in progress, or another cache layer may still be involved.
Is flushing DNS safe?
Yes. It is a normal troubleshooting step and only clears temporary cached DNS records.