How to flush your DNS cache on any system
Flushing your DNS cache forces your machine to forget every domain to address mapping it has memorized and look them up fresh. It takes one command, it is completely safe, and it fixes exactly one class of problem: your machine remembering an answer that is no longer true, typically right after a DNS change. Here are the commands, then when they help and when they cannot.
How do you flush DNS on each system?
macOS (all recent versions):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Windows (Command Prompt or PowerShell, no admin needed):
ipconfig /flushdns
Windows confirms with "Successfully flushed the DNS Resolver Cache." You can inspect what was cached beforehand with ipconfig /displaydns.
Linux with systemd-resolved (Ubuntu, Fedora, most modern desktops):
resolvectl flush-caches
Check it worked with resolvectl statistics, which shows the cache size back at zero. On older setups the resolver might be dnsmasq (sudo systemctl restart dnsmasq) or nscd (sudo systemctl restart nscd); if none of these services exist, your distro likely caches nothing at the OS level and there is nothing to flush.
Your browser has its own cache on top. Chrome and Edge keep an internal DNS cache that survives an OS flush: visit chrome://net-internals/#dns (or edge://net-internals/#dns) and press "Clear host cache". Firefox caches for a short time and clears on restart, or via about:networking#dns. If a site works in one browser but not another after a DNS change, this layer is almost always why.
What actually happens when you flush?
Name resolution is a chain of caches. Your browser asks the operating system, the OS asks your configured resolver (your router, your ISP, or a public resolver like 1.1.1.1 or 8.8.8.8), and that resolver asks the authoritative nameservers that actually hold the zone. Every hop caches the answer for the record's TTL, its time to live in seconds, so repeat visits skip the whole journey.
Flushing clears only the caches on your machine: browser and OS. Your router, your ISP's resolver, and every resolver in the world keep their copies until each one's TTL runs out. This is why flushing is powerful for local staleness and powerless against global propagation, and why two people can see different answers for the same domain at the same moment. The full mechanics are covered in DNS propagation explained.
When does flushing actually help?
- You just changed a DNS record and your own machine still resolves the old value while the DNS Propagation checker shows resolvers worldwide already returning the new one.
- You edited your hosts file and want the change picked up immediately.
- You switched between VPN and normal networking, and names that resolve differently inside the VPN (internal hostnames especially) are stuck on the wrong answer.
- A site moved hosting and you are getting certificate errors or the old server; a cached A record can outlive the migration on your machine.
- Development against changing records, where you are actively editing zones and need each test to be honest.
When can flushing not help?
- The change has not propagated yet. If authoritative nameservers or upstream resolvers still serve the old value, a fresh lookup fetches the same stale answer. Check what resolvers around the world currently return with the DNS Propagation checker; if they show the old value, the wait is upstream and no local command shortens it.
- The record itself is wrong. Flushing fetches the current truth; it cannot fix the truth. Verify what the authoritative servers actually say with the DNS Lookup tool.
- The problem is not DNS. If the name resolves to the right address but the site still misbehaves, you are past DNS: think caching, certificates, or the server itself.
A practical diagnostic order: look the record up directly, compare against what your machine resolves (nslookup example.com on any OS), and only conclude "stale cache" when the two disagree. That takes one minute and beats flushing on faith.
Can you avoid needing this next time?
If you administer the zone: lower the TTL before you make the change, not after. Dropping a record's TTL to 300 seconds a day in advance means that when you flip the value, the whole internet forgets the old answer within five minutes. Raise it back afterwards. If you find yourself flushing regularly because your ISP's resolver holds records too long or serves stale data, switching your DNS to a public resolver like 1.1.1.1 or 8.8.8.8 is a permanent fix.
The record types themselves, A, AAAA, CNAME, MX, TXT, and what each one does, are laid out in DNS records explained if you want the map behind the commands.