How to Flush DNS Cache
Your computer keeps a short-term memory of every website it has recently looked up, mapping each domain name to its IP address so it does not have to ask a DNS server again. That memory is the DNS cache. Most of the time it makes browsing faster, but when a site moves to a new server or you have just changed a DNS record, a stale entry can send you to the wrong place or break the connection. Flushing the DNS cache wipes those stored entries so the next lookup is fresh. This guide gives you the exact commands for Windows, macOS, and Linux, shows how to clear the browser's separate DNS cache, and explains how to confirm the flush actually worked.
What is the DNS cache?
The Domain Name System (DNS) translates human-friendly names such as example.com
into the numeric IP addresses that machines actually connect to. Because that lookup happens
for almost every request, your operating system, your browser, your router, and your internet
provider's resolver all keep a local copy of recent answers. That stored copy is the DNS
cache, and reusing it saves a full round trip to a DNS server.
Each cached record carries a TTL (time to live) measured in seconds, set by the domain's owner. While the TTL is still counting down, your computer reuses the cached IP without asking again. When the TTL expires, the entry is discarded and the next request triggers a fresh lookup. In other words, the cache cleans itself over time, which is why you rarely need to flush it manually. To understand the full lookup chain behind these records, see our guide on how DNS works.
Cache vs. propagation
Flushing your local cache only clears your machine. If a website owner recently changed a record, other resolvers across the internet may still be serving the old value until their own TTL expires. That gradual rollout is called DNS propagation, and no local flush can speed it up. You can watch it happen with our DNS Propagation Checker.
When should you flush the DNS cache?
Flushing is a targeted troubleshooting step, not routine maintenance. The situations where it genuinely helps are fairly specific:
- A site moved servers. A domain you visit was migrated to a new host and your machine is still loading the old IP, showing an outdated page or an error.
- You just changed a DNS record. If you administer a domain and updated an A, AAAA, or CNAME record, flushing locally lets you test the new value once it has propagated, instead of seeing the cached old one.
- Persistent "site cannot be reached" errors. A site loads fine on another network or device but not on yours, hinting that a corrupted or stale cache entry is the culprit.
- After changing your DNS provider. Switching to a resolver such as Cloudflare's
1.1.1.1or Google's8.8.8.8is a good moment to clear out answers cached from the old one. - Suspected DNS poisoning or hijacking. Flushing removes any maliciously injected entry so that a clean lookup can replace it (alongside other security steps).
If none of these apply, you usually do not need to flush anything. A failed connection is more often a TTL that has not expired yet, a browser-level cache, or a propagation delay, all of which a local flush will not fix.
How to flush the DNS cache on Windows
Windows stores DNS answers in the DNS Client service (also called dnscache).
Clearing it takes one command in an elevated terminal.
- Press the Windows key, type
cmd, then right-click Command Prompt and choose Run as administrator. (PowerShell works too.) - Type the following command and press Enter:
ipconfig /flushdns
On success you will see the message: Successfully flushed the DNS Resolver Cache. That is the entire process; no reboot is required.
Useful related Windows commands
| Command | What it does |
|---|---|
ipconfig /flushdns |
Clears the resolver cache (the flush itself). |
ipconfig /displaydns |
Prints the current cache so you can confirm it is empty after a flush. |
ipconfig /registerdns |
Renews DHCP leases and re-registers DNS names; useful after network changes. |
If the command seems to do nothing
The error "The requested operation requires elevation" means the prompt was not
opened as administrator. Close it and reopen Command Prompt with Run as
administrator. If the DNS Client service has been disabled, you can restart it
with net stop dnscache followed by net start dnscache.
How to flush the DNS cache on macOS
On macOS the cache is managed by two services: mDNSResponder and the directory
services daemon. The reliable approach on modern versions (macOS 10.11 El Capitan through the
current releases) is to clear the directory cache and then signal mDNSResponder
to reload. Open Terminal (Applications → Utilities → Terminal) and
run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
You will be prompted for your administrator password (nothing is shown as you type, which is normal). There is no confirmation message on macOS; a silent return to the prompt means it worked. Running both parts together, as shown, is what clears the cache reliably across recent macOS versions.
Older macOS versions
On much older releases the command differed: macOS 10.10 Yosemite used
sudo discoveryutil mdnsflushcache, while versions before 10.9 used
sudo killall -HUP mDNSResponder on its own. If you are on a current macOS,
the combined dscacheutil and killall command above is the one to
use.
How to flush the DNS cache on Linux
Linux does not cache DNS at the operating-system level by default. Whether you have a cache to flush depends on which resolver service your distribution runs. The command you need matches the service you have, so identify it first.
systemd-resolved (Ubuntu, recent Debian, Fedora, and most modern distros)
If systemd-resolved is active, flush its cache with one of these (the newer
resolvectl replaces the older systemd-resolve):
sudo resolvectl flush-caches
# on older systemd versions:
sudo systemd-resolve --flush-caches
You can confirm the cache is empty by checking the statistics with
resolvectl statistics and watching the current cache size drop to zero.
dnsmasq
If your system or router uses dnsmasq, restart the service to clear its cache:
sudo systemctl restart dnsmasq
nscd (Name Service Cache Daemon)
On systems running nscd, invalidate the hosts cache or restart the daemon:
sudo nscd -i hosts
# or restart it entirely:
sudo systemctl restart nscd
Not sure which one you have?
Run systemctl is-active systemd-resolved, systemctl is-active dnsmasq,
and systemctl is-active nscd in turn; the one that reports active is
the cache you need to flush. If none are active, your machine is not caching DNS locally and
there is nothing to clear at the OS level.
Flushing the browser DNS cache (Chrome and others)
Browsers keep their own internal DNS cache that is completely separate from the operating system. This is the single most common reason people flush the OS cache and still see the old site: the browser served its own cached answer. Clear it directly.
Google Chrome, Microsoft Edge, Brave, and other Chromium browsers
- Open a new tab and go to
chrome://net-internals/#dns(in Edge useedge://net-internals/#dns). - Click the Clear host cache button.
- For lingering connections, open the Sockets page in the same tool and click Flush socket pools.
Mozilla Firefox
Firefox clears its DNS cache when you restart it, or you can force it without a restart: open
about:networking#dns and click Clear DNS Cache.
Best practice order
When troubleshooting, flush in this order: the browser cache first, then the operating system cache, then restart your router if the problem persists. Clearing the browser cache alone resolves a surprising share of "the old page still loads" complaints.
How to verify the flush worked
A successful flush is easy to confirm. The exact check depends on your platform:
- Windows. Run
ipconfig /displaydns. Right after a flush it should report that the cache is empty (or show only a handful of system entries). Visit a site, run it again, and you will see new entries appear, proving the cache is rebuilding from fresh lookups. - macOS. There is no built-in dump command, so verify behaviorally: visit the site that was failing and confirm it now loads the correct page. You can also use the
digornslookuptools to compare the answer your machine returns against an authoritative source. - Linux (systemd-resolved). Run
resolvectl statisticsbefore and after; the current cache size should drop to zero immediately after the flush.
To be certain the address your machine now resolves matches what the domain's authoritative servers actually publish, run the domain through our DNS Lookup tool. If your local answer disagrees with what the lookup returns, the difference is either a not-yet-expired cache somewhere upstream or a record still propagating. Our DNS Health Check can flag misconfigurations that make a domain look broken even after a clean flush.
If a fresh lookup still returns the wrong IP
Then the stale data is not on your machine. The record may still be propagating, or your router or ISP resolver is caching it. Reboot the router, and if you administer the domain, lower the record's TTL before future changes so the next update rolls out in minutes rather than up to 48 hours.
Related tools & reading
- DNS Lookup — query A, AAAA, MX, TXT, NS and more for any domain to confirm what should resolve.
- DNS Propagation Checker — see whether a record change has reached resolvers worldwide.
- DNS Health Check — spot misconfigurations behind a domain that will not load.
- IP Lookup — check the details behind any IP address a flush reveals.
- MAC Address Lookup — identify the hardware vendor behind a device on your local network.
- How DNS Works — the resolver, root, TLD and authoritative lookup flow explained.
- Back to the Learning Center
Frequently asked questions
What does flushing the DNS cache actually do?
Flushing the DNS cache deletes the locally stored list of recently resolved domain names and their IP addresses. The next time you visit a site, your computer has to look the address up again from scratch instead of reusing a stale, possibly outdated entry. It does not delete cookies, browsing history, or saved passwords, and it does not change your IP address.
Will flushing my DNS cache log me out of websites or delete anything important?
No. The DNS cache only stores domain-to-IP mappings, not your sessions or files. Clearing it has no effect on logins, cookies, downloads, or settings. The only short-term effect is that the first lookup for each site you visit afterward is slightly slower while the cache rebuilds, which usually adds only a few milliseconds.
How often should I flush my DNS cache?
There is no need to flush it on a schedule. The cache is self-cleaning: every entry expires automatically once its TTL (time to live) runs out. Flush it only when you have a reason, such as a website that moved to a new server, a DNS record you just changed, or a "site cannot be reached" error that persists after the site is confirmed to be up elsewhere.
I flushed my DNS cache but the old site still loads. Why?
The most common cause is that your browser keeps its own DNS cache separate from the operating system. Clear the browser cache (in Chrome, visit chrome://net-internals/#dns and click "Clear host cache"). The other common cause is your router or upstream resolver still serving the old record until its TTL expires, or the DNS change has not finished propagating worldwide. A propagation checker confirms whether the new record has rolled out yet.
Does flushing the DNS cache change or hide my IP address?
No. The DNS cache stores the addresses of websites you connect to, not your own public IP. Flushing it has no effect on the address the internet sees for you. To check your current public IP, use an IP lookup tool; to change or mask it you would need a different method such as a VPN or a new connection from your ISP.