Guides

How to flush the DNS cache on Windows, macOS and Linux

The exact command for each OS: ipconfig /flushdns on Windows, dscacheutil on macOS, resolvectl flush-caches on Linux, plus clearing Chrome and Firefox's own DNS cache.

Published ~7 min read

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 — useful right after you change a DNS record and the old IP keeps showing up.

OSCommand
Windowsipconfig /flushdns
macOS (modern)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Linux, systemd-resolvedsudo resolvectl flush-caches
Linux, nscdsudo systemctl restart nscd
Linux, dnsmasqsudo systemctl restart dnsmasq (or: kill -SIGHUP $(pidof dnsmasq))
Chrome / Edgechrome://net-internals/#dns → Clear host cache
Firefoxabout:networking#dns → Clear DNS Cache

Windows

Command Prompt or PowerShell (no admin needed)
ipconfig /flushdns

It 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 /displaydns

macOS

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):

Terminal
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

The 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 → dnsmasq
systemd-resolved (Ubuntu, Fedora, most current distributions)
sudo resolvectl flush-caches
# Older alias for the same thing, deprecated but still present on some systems:
sudo systemd-resolve --flush-caches
nscd (Name Service Cache Daemon, where installed)
sudo systemctl restart nscd
dnsmasq (common on routers and some desktop setups)
sudo systemctl restart dnsmasq

Browsers keep their own cache too

A browser resolves hostnames itself and caches the result independently of the operating system — flushing the OS cache does not touch it:

BrowserSteps
Chrome / Edge / BraveOpen chrome://net-internals/#dns (or edge://net-internals/#dns), click Clear host cache
FirefoxOpen about:networking#dns, click Clear DNS Cache
SafariNo 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.

Related articles

All guides