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.