Flush DNS command
Published 19 September 2026
The flush DNS command for each operating system is below. Then the part that trips people up, and the reason so many Linux guides are useless: most Linux systems have no DNS cache to flush at all. The commands you find still run, still print nothing, and still change nothing, because there was never anything there.
The commands
| System | Command |
|---|---|
| Windows | ipconfig /flushdns |
| Windows (PowerShell) | Clear-DnsClientCache |
| macOS | sudo dscacheutil -flushcachesudo killall -HUP mDNSResponder |
| Linux | Depends entirely on what is running: see below. Often nothing. |
On macOS run both lines; they clear different caches and neither prints anything on success.
Windows
ipconfig /flushdns in Command Prompt or PowerShell. Mind the
slash: ipconfig flushdns without one prints the usage text
rather than flushing anything, which is easy to skim past as success.
Verify with ipconfig /displaydns, which should be all but empty
afterwards. Two failures are common and mean different things: "The
requested operation requires elevation" needs an administrator prompt,
and "Could not flush the DNS Resolver Cache" usually means the DNS
Client service is stopped.
The full version, including the negative cache that makes a record you just created keep reporting "no such name": ipconfig /flushdns explained.
macOS
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Both are needed. Check with dscacheutil -statistics: the
entry counts drop to nothing after a successful flush. Older guides
suggesting lookupd or discoveryutil are for macOS
versions long gone; those binaries no longer exist.
The full version: clearing the DNS cache on a Mac.
Linux: find out whether you have a cache first
This is where most advice goes wrong. glibc does not cache DNS. A plain Linux install (many servers, plenty of desktops) resolves every name afresh and holds nothing between lookups. There is no cache, so there is nothing to flush, and every command you try will appear to do nothing because it genuinely did nothing.
Search for a flush DNS Linux command and you get a list of daemons,
usually nscd, dnsmasq and
systemd-resolved, offered as though one of them must be yours. Most guides to clear DNS cache
Linux skip the question that decides everything: is anything caching at
all? The flush DNS Ubuntu answer is usually systemd-resolved
on a desktop and nothing at all on a minimal server.
Caching on Linux only happens if something was installed to do it. Find out which, before running anything:
systemctl is-active systemd-resolved # the common one on modern distros
systemctl is-active nscd
systemctl is-active dnsmasq
systemd-resolved
The usual answer on Ubuntu 18.04 and later, Fedora, and most current desktops. This is what people mean by flush DNS on Ubuntu:
sudo resolvectl flush-caches
On older releases the same job was sudo systemd-resolve
--flush-caches, which still works on some systems and is gone on
others. Verify either with:
resolvectl statistics
The cache hit and miss counters reset. That is the confirmation: worth having, because a successful flush and a command that silently did nothing look identical.
nscd
The old Name Service Cache Daemon. Present on some servers, absent on most modern desktops:
sudo nscd -i hosts # invalidate just the hosts cache
sudo systemctl restart nscd
dnsmasq
Common on routers and on some NetworkManager configurations, where it acts as a local forwarder:
sudo systemctl restart dnsmasq
BIND, if the box is a resolver
sudo rndc flush # everything
sudo rndc flushname example.com # one name
Flushing a cache does not validate the daemon or install a security update. If you operate the server, the BIND DNS server patching guide covers version checks, configuration validation and one-node-at-a-time verification.
If none of them are running
Then you have your answer, and it is a useful one: the stale record is not on this machine. It is in your browser, your router, or your upstream resolver, and only one of those is yours to clear.
Check whether flushing could help at all. Before touching anything, ask a public resolver what it is actually serving. The DNS propagation checker asks Cloudflare and Google the same question and shows whether they agree, with the TTL each is holding. If they already have the new record and your machine does not, flushing fixes it. If they still have the old one, nothing you type locally will help, and the TTL says how long.
Why flushing so often changes nothing
Your machine is one cache among several, and the flush DNS command reaches exactly one of them:
| Cache | Can you clear it? | Holds for |
|---|---|---|
| Your operating system | Yes: the commands above | Until flushed, or the TTL |
| Your browser | Separately, see below | Minutes |
| Your router | Only by rebooting it | Varies wildly |
| Your resolver: ISP, Cloudflare, Google | No | The record's TTL |
That last row decides most cases. Change a record with a one-hour TTL and the public resolvers serve the old value for up to an hour regardless of what you type. You are not failing to flush: you are waiting, and the only question is how long.
The browser has its own cache
Chrome and Edge keep a host cache independent of the operating system, and many installs now use DNS over HTTPS, resolving names directly to a provider without asking the OS at all. When that is on, no flush DNS command can help, because the browser was never using the cache you cleared.
Clear it at chrome://net-internals/#dns or
edge://net-internals/#dns. The tell is quick: if
nslookup or dig returns the right address and the
browser still goes somewhere else, stop flushing the system cache.
What flushing is not for
- A name that never resolved. Flushing clears wrong answers; it cannot invent a right one. Check the record exists first.
- Speed. An empty cache is briefly slower, not faster.
- "Propagation." There is no such process: only TTLs, and other people's resolvers honouring them.
- Connectivity. If nothing resolves at all, the question is whether you can reach a resolver, which is a different fault. See no route to host for telling refused, timed out and unreachable apart.