Networking & DNS

Flush DNS cache on Windows, macOS, Linux and browsers

Clear cached DNS answers after changing records or moving hosts: commands for Windows, macOS, Linux (systemd-resolved, nscd, dnsmasq), Chrome and Firefox, and when flushing won't help.

BeginnerEveryone2 min read

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

  1. Open Command Prompt or PowerShell as administrator.
  2. Run:
    ipconfig /flushdns
  3. 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 mDNSResponder

There is no confirmation message; enter your password when asked.

Linux

If your system uses…Command
systemd-resolved (Ubuntu, Fedora…)sudo resolvectl flush-caches
nscdsudo systemctl restart nscd
dnsmasqsudo systemctl restart dnsmasq
Unboundsudo unbound-control flush_zone example.com
No local cacheNothing to flush

Check statistics with resolvectl statistics on systemd-resolved systems.

Browsers

  • Chrome / Edge / Brave: open chrome://net-internals/#dns (or edge://net-internals/#dns) and click Clear host cache. Then on the Sockets tab click Flush socket pools.
  • Firefox: open about:networking#dns and 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.com

Remove 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.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.