Short answer: Windows: ipconfig /flushdns. macOS: sudo dscacheutil -flushcache. Linux with systemd-resolved: sudo resolvectl flush-caches. Each clears the local resolver’s cache so the next lookup asks the DNS server again instead of reusing a stale answer, which is useful right after you change a DNS record and the old IP keeps showing up.
| OS | Command |
|---|---|
| Windows | ipconfig /flushdns |
| macOS (modern) | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| Linux, systemd-resolved | sudo resolvectl flush-caches |
| Linux, nscd | sudo systemctl restart nscd |
| Linux, dnsmasq | sudo systemctl restart dnsmasq (or: kill -SIGHUP $(pidof dnsmasq)) |
| Chrome / Edge | chrome://net-internals/#dns → Clear host cache |
| Firefox | about:networking#dns → Clear DNS Cache |
Windows
ipconfig /flushdnsIt replies Successfully flushed the DNS Resolver Cache. whether or not the cache had anything in it. To see what is cached before clearing it:
ipconfig /displaydnsmacOS
The command has changed across macOS versions. This is the one that works on current releases (Ventura, Sonoma and later, and it has worked unchanged back to Sierra):
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponderThe first clears the Directory Service cache, the second tells mDNSResponder (the process that actually resolves DNS on macOS) to reload. Run both; either alone leaves part of the cache in place on some versions.
Linux
Which command works depends on which resolver the distribution uses. Check first:
resolvectl status 2>/dev/null | head -1 # present → systemd-resolved
systemctl is-active nscd 2>/dev/null # active → nscd
systemctl is-active dnsmasq 2>/dev/null # active → dnsmasqsudo resolvectl flush-caches
# Older alias for the same thing, deprecated but still present on some systems:
sudo systemd-resolve --flush-cachessudo systemctl restart nscdsudo systemctl restart dnsmasqBrowsers keep their own cache too
A browser resolves hostnames itself and caches the result independently of the operating system, and flushing the OS cache does not touch it:
| Browser | Steps |
|---|---|
| Chrome / Edge / Brave | Open chrome://net-internals/#dns (or edge://net-internals/#dns), click Clear host cache |
| Firefox | Open about:networking#dns, click Clear DNS Cache |
| Safari | No dedicated page; quitting Safari fully clears its in-memory cache |
The router has a cache too
Most home routers run their own small DNS cache for the devices behind them. If flushing every device’s cache still shows the old answer, reboot the router. There is rarely a button for clearing it on its own, and a reboot is quick enough that it is usually not worth hunting for one.
When flushing actually fixes something
Flushing helps exactly one situation: a DNS record changed, and something between you and the authoritative server is still handing out the old value from before the change. It does not fix a record that is wrong at the source, a propagation delay still within the record’s TTL, or a connection problem once the IP resolves correctly; those need a different fix further down the chain.
If lookups fail outright rather than returning a stale answer, that is a different problem. See DNS server not responding.
For how a DNS lookup actually travels from your resolver to the authoritative server in the first place, see what is DNS.
Pointing a domain at a new server for the first time, or moving it to a new one? See pointing a domain at a VPS for the DNS side, including how TTL affects how long the old answer lingers for other people even after you flush your own cache.
Frequently asked
How do I flush DNS on Windows?
Open Command Prompt or PowerShell and run ipconfig /flushdns. No administrator rights are needed, and it replies 'Successfully flushed the DNS Resolver Cache' regardless of whether anything was actually cached.
How do I flush DNS on a Mac?
sudo dscacheutil -flushcache followed by sudo killall -HUP mDNSResponder. Run both: the first clears the Directory Service cache, the second reloads the process that actually resolves lookups.
How do I flush DNS on Linux?
It depends on the resolver: sudo resolvectl flush-caches for systemd-resolved (most current distributions), sudo systemctl restart nscd for nscd, or sudo systemctl restart dnsmasq for dnsmasq. A minimal server with none of these running often caches nothing locally at all.
Will flushing DNS fix a website showing the wrong content?
Only if the cause is a stale answer cached somewhere between you and the DNS record (a changed A record, for instance). It will not fix a record that is wrong at the source, or a connection problem once the domain resolves to the correct address.