Clearing the DNS cache

There is not one cache. There are at least four, stacked, and clearing the wrong one achieves nothing. Here is each of them, in the order that actually resolves the problem.

Clearing the DNS cache

The short version

  • There are four caches: Browser, operating system, router and resolver. You control the first three.
  • Chrome and Firefox keep their own caches that survive an OS flush.
  • You cannot clear your ISP resolver's cache - Switching resolver is the workaround.
  • Negative answers are cached too, which is why a fixed domain can stay broken for you.

"Flush your DNS" is standard advice and it is usually given incompletely, which is why it so often fails to work. There is no single DNS cache. There are four layers of them, and an answer cached in a layer you did not clear will be served straight back to you.

In the order a query travels:

  1. The browser's own cache - Chrome and Firefox both keep one, independent of the system.
  2. The operating system cache - What "flush DNS" usually means.
  3. The router cache - Most home routers cache, some for a long time.
  4. The resolver's cache - Your ISP's or a public resolver's. You cannot touch this one.

Windows

Open Command Prompt or PowerShell as Administrator:

ipconfig /flushdns

You should see "Successfully flushed the DNS Resolver Cache." To inspect what is cached before clearing:

ipconfig /displaydns

If flushing does not help, restart the DNS Client service, which occasionally gets stuck:

net stop dnscache
net start dnscache

macOS

The command has changed across versions. On any release from Sequoia back to Yosemite:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Both halves matter - The first clears the directory service cache, the second restarts the multicast DNS responder. There is no confirmation message; silence means it worked.

Linux

Depends on what is running. With systemd-resolved, which is the default on most modern distributions:

sudo resolvectl flush-caches

With dnsmasq:

sudo systemctl restart dnsmasq

With nscd:

sudo systemctl restart nscd

If none of those exist, your system probably is not caching at all and queries go straight to the configured resolver.

iOS and iPadOS

No command and no setting. Two options:

  • Airplane mode on, wait ten seconds, off. Usually enough, and non-destructive.
  • Reset Network Settings (Settings → General → Transfer or Reset → Reset). Definitely clears it, and also forgets every saved Wi-Fi password - So have them to hand.

Android

Same situation. Airplane mode is the gentle option. Otherwise clear the browser's own cache, or restart the device.

Chrome on Android has its own DNS cache reachable at chrome://net-internals/#dns, which is worth trying before anything system-wide.

The browser caches everyone forgets

This is the step that makes the difference when the system flush "did not work".

Chrome and other Chromium browsers: Go to chrome://net-internals/#dns and press Clear host cache. Then chrome://net-internals/#sockets and Flush socket pools - An existing pooled connection to the old address will otherwise keep being reused.

Firefox: about:networking#dns, then Clear DNS Cache.

Safari: No separate cache; quitting and reopening the application is sufficient.

The router

Most home routers cache DNS, and some hold negative answers for a very long time. A restart clears it. Power off for thirty seconds rather than using a quick reset - A brief cycle sometimes preserves state you were trying to discard.

This is genuinely one of the few problems where "have you tried turning it off and on again" is the correct diagnosis rather than a joke.

The one you cannot clear

Your ISP's resolver caches on its own schedule, governed by the TTL on each record, and you have no way to influence it. If a record has changed and your ISP is still serving the old one, your options are to wait or to stop using that resolver.

Switching your device to a public resolver bypasses the problem instantly, which is why it is the recommendation whenever a DNS change is not propagating. Here is how to do it on every platform.

Negative caching

Worth repeating because it explains the most confusing version of this problem. DNS caches "does not exist" answers as well as real ones, for a duration set in the domain's SOA record.

So if you visited a domain in the window before its records went live, you may hold NXDOMAIN for anywhere from minutes to hours - And every retry returns the cache rather than asking again. The site works perfectly for everyone else. Clearing every cache you control is the fix, and if the negative answer is held at the resolver, switching resolvers is the only quick route.

A note on propagation

"DNS propagation" is a slightly misleading phrase - Nothing propagates. Records are published immediately at the authoritative nameservers, and what takes time is existing caches expiring. The record's TTL determines how long.

Which means: If you know you are about to change a record, lower its TTL a day beforehand. Doing it after the change achieves nothing, because everyone already holds the old value with the old TTL.

Questions people ask

How do I clear the DNS cache on Windows?

Open Command Prompt as Administrator and run ipconfig /flushdns. If that does not help, restart the DNS Client service with net stop dnscache followed by net start dnscache. Remember to clear your browser's own cache as well.

Why did flushing DNS not fix my problem?

Because there are four caches and you probably cleared one. Chrome and Firefox keep their own, separate from the operating system; your router keeps another; and your ISP's resolver keeps one you cannot touch at all. Clear all three you control, then switch resolver if the problem persists.

How do I clear the DNS cache on a phone?

Neither iOS nor Android exposes a command. Toggling airplane mode on and off for ten seconds is usually enough. Resetting network settings definitely works but also forgets every saved Wi-Fi password.

How long does DNS propagation take?

Nothing actually propagates - Records publish immediately and existing caches expire on their own schedule, set by each record's TTL. Typical values are between five minutes and 48 hours. Lowering the TTL before a planned change shortens the window; lowering it afterwards does nothing.

Read next

When DNS stops working

How DNS resolution fails, how to confirm it is the cause, and how to fix it - Including which resolver to switch to and why.

Connection troubleshooting4 min read

DNS_PROBE_FINISHED_NXDOMAIN

What DNS_PROBE_FINISHED_NXDOMAIN means, the difference between a genuinely non-existent domain and a resolver problem, and how to tell them apart.

Error codes explained4 min read

Browser-side causes

How browser caches, service workers, extensions and stale cookies break working websites, and the one test that rules out all four at once.

Connection troubleshooting4 min read

Is it my internet, or the website?

A layered diagnostic for working out whether the fault is your device, your network, your ISP, DNS, or the website itself.

Connection troubleshooting4 min read