Your computer, browser and router all remember DNS answers for a while. After you change a DNS record or move your site to a new server, you might still see the old site because of that cache. Flushing the DNS cache makes your device ask again. This guide gives the commands for every common system.
Before you start
Flushing only clears your caches. Your ISP's resolver keeps its copy until the record's TTL expires. Check what the world sees with dig @1.1.1.1 example.com +short.
Windows
- Open Command Prompt or PowerShell as administrator.
- Run:
ipconfig /flushdns - You should see "Successfully flushed the DNS Resolver Cache". In PowerShell you can also use
Clear-DnsClientCache.
macOS
Open Terminal and run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderThere is no confirmation message; enter your password when asked.
Linux
| If your system uses… | Command |
|---|---|
| systemd-resolved (Ubuntu, Fedora…) | sudo resolvectl flush-caches |
| nscd | sudo systemctl restart nscd |
| dnsmasq | sudo systemctl restart dnsmasq |
| Unbound | sudo unbound-control flush_zone example.com |
| No local cache | Nothing to flush |
Check statistics with resolvectl statistics on systemd-resolved systems.
Browsers
- Chrome / Edge / Brave: open
chrome://net-internals/#dns(oredge://net-internals/#dns) and click Clear host cache. Then on the Sockets tab click Flush socket pools. - Firefox: open
about:networking#dnsand click Clear DNS Cache. - If the browser uses DNS over HTTPS, it has its own resolver – clearing its cache is the only step that matters for it.
Phones and routers
- iPhone/Android: toggle airplane mode on and off, or restart the device.
- Home router: restart it if it acts as your DNS server.
Preview a new server without waiting
To test a site on a new server before DNS changes reach you, add a line to your hosts file (C:\Windows\System32\drivers\etc\hosts on Windows, /etc/hosts on macOS/Linux):
203.0.113.50 example.com www.example.comRemove it after testing, or you'll keep seeing that IP forever.
When flushing won't help
- The record hasn't been changed at the right DNS provider – check the domain's nameservers.
- Your ISP's resolver still caches the old answer – wait for the TTL or switch to another resolver temporarily.
- A hosts file entry overrides DNS.
- A CDN or proxy (such as Cloudflare) is still pointing to the old origin.
FAQ: flushing DNS
Is it safe to flush the DNS cache?
Yes. The only effect is that the next lookups take a few milliseconds longer.
How do I know if DNS has updated?
Compare nslookup example.com on your machine with queries to public resolvers or the authoritative nameserver.
Why does my phone show the old site but my PC the new one?
Each device and network has its own caches and resolvers; they expire at different times.
