To flush the DNS cache, run one command for your platform. On Windows, use ipconfig /flushdns in an elevated Command Prompt. On macOS, use sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder in Terminal. On Linux with systemd-resolved, use sudo resolvectl flush-caches. Chrome and Edge keep their own host cache, which you clear from the net-internals page. Each of these takes seconds, and together they remove stale domain name system (DNS) answers that keep sending your machine to an old or wrong IP address.

Run the OS-level flush first, clear your browser’s host cache second, then confirm with a fresh external lookup so you know the fix worked. Skipping that last step is how you end up flushing five times while the real fault sits on a router, a VPN, or an upstream resolver.
At PacketTools, we use this exact sequence in production after DNS cutovers and during connectivity issues. Our free tools run in real time and never log IPs, queries, or test data. The steps below cover every layer, from the OS cache to the browser, and show you how to tell a local caching problem from a DNS record that is wrong everywhere.
How Do You Clear the DNS Cache on Windows?
Windows 10 and Windows 11 clear the DNS Client cache with the same command, ipconfig /flushdns. PowerShell offers an equivalent cmdlet, and ipconfig /displaydns lets you see what was cached before and after.
Use ipconfig /flushdns in Command Prompt
This is the method that works on every supported Windows build:
- Press Start, type
cmd, right-click Command Prompt, and choose Run as administrator. - Type
ipconfig /flushdnsand press Enter. - Look for the line “Successfully flushed the DNS Resolver Cache.”
Always use an elevated prompt. As the Hostinger walkthrough for Windows 10 and 11 warns, a standard prompt won’t have the permissions needed to flush the cache. You can also paste the command into the Win+R Run box. That route gives you no feedback, though, so the Command Prompt confirmation line is worth the extra five seconds.
Use Clear-DnsClientCache in PowerShell
If you script your maintenance or already work in Windows PowerShell, use the native cmdlet:
- Right-click Start and open Windows PowerShell (Admin) or Terminal (Admin).
- Accept the UAC prompt.
- Run
Clear-DnsClientCache.
The cmdlet returns silently when it succeeds. Lifewire’s Windows 10 instructions describe it as a separate method that does the same job as ipconfig /flushdns. It fits neatly into remote sessions and remediation scripts, where parsing ipconfig output is awkward.
Inspect Cached Entries with ipconfig /displaydns
Before you flush, run ipconfig /displaydns | findstr /i "yourdomain" to see what Windows is holding for the problem host. Check the Record Type, the A (Host) Record, and the Time To Live field.
If the cached IP address differs from what the authoritative DNS records say, you have confirmed a stale entry. Flush, then run /displaydns again. The entry should be gone until the next lookup repopulates it with the current answer. Keep a copy of the “before” output when you are troubleshooting for someone else, because it is your evidence that the cache was the culprit.
How Do You Clear the DNS Cache on macOS?
Every current version of macOS uses one Terminal line. It combines dscacheutil -flushcache with a HUP signal to mDNSResponder, the daemon that handles resolution on a Mac. Expect no success message.
Run the Current macOS Terminal Commands
- Press Command + Space, type Terminal, and press Return.
- Paste this line:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Enter your admin password when prompted.
The first half clears the Directory Service cache through dscacheutil. The second half tells mDNSResponder to drop its cached answers without quitting. Running only sudo dscacheutil -flushcache leaves mDNSResponder’s cache in place on modern releases, so use both parts.
Very old Macs used different commands. Yosemite used discoveryutil udnsflushcaches, and Leopard used lookupd. Anything from Big Sur through Sequoia takes the combined line above.
What Should You Expect After Entering Your Password?
Nothing visible happens, and that is normal. Your password won’t echo while you type, and a fresh prompt line means the command ran. As this Mac-specific guide notes, macOS shows no confirmation message after the reset.
An error appears only if you mistype the command or your account lacks admin rights. To verify the flush, run dscacheutil -q host -a name yourdomain.com and compare the result with an external lookup. Safari relies on the system resolver, so this flush also clears Safari’s view. Chrome on a Mac still needs its own host cache cleared, which is covered below.
How Do You Clear the DNS Cache on Linux?
Linux has no single DNS resolver cache. You flush whichever daemon is caching, which is systemd-resolved on modern Ubuntu and Debian, or nscd or dnsmasq on some other builds. Figure out which one you have before you run anything.
Identify Which Resolver Is Caching DNS
Start by running these three commands:
systemctl is-active systemd-resolvedsystemctl is-active nscdsystemctl is-active dnsmasq
Any service that returns active holds a cache. It also helps to look at /etc/resolv.conf. A nameserver 127.0.0.53 line means systemd-resolved’s stub listener is in the path.
Distribution defaults differ. In How-To Geek’s testing, local caching was off on Manjaro 21 but on by default on Fedora 37 and Ubuntu 22.10. Older CentOS servers often run nscd instead. If none of these services is active, your machine isn’t caching locally, and the stale answer is coming from upstream.
Flush systemd-resolved on Ubuntu or Debian
On current releases, run:
sudo resolvectl flush-caches
Older systemd versions use sudo systemd-resolve --flush-caches. The systemd-resolve binary was replaced by resolvectl, but some LTS systems still ship both.
Confirm the flush worked with resolvectl statistics. The “Current Cache Size” should read 0 and then climb again as new lookups arrive.
Clear nscd or dnsmasq Only If Installed
Run these only when the service check showed them active:
| Resolver | Flush command |
|---|---|
| nscd | sudo nscd -i hosts or sudo systemctl restart nscd |
| dnsmasq | sudo killall -HUP dnsmasq or sudo systemctl restart dnsmasq |
| BIND (local) | sudo rndc flush |
Sending a HUP to dnsmasq clears its cache without dropping DHCP leases, which makes it the gentler choice on a box that also serves your LAN. Flushing systemd-resolved does nothing to a dnsmasq cache sitting in front of it, and that mismatch is a common reason a flush “didn’t work.”
Could Your Browser Still Be Using a Cached Address?

Yes. Chromium-based browsers keep an internal host resolver cache, so a site can stay broken after an OS flush until you clear the browser layer too. Firefox has its own cache as well. Clearing cookies and images does not touch either one.
Clear the Host Cache in Google Chrome or Microsoft Edge
- In Google Chrome, open
chrome://net-internals/#dns. In Microsoft Edge, openedge://net-internals/#dns. - Click Clear host cache.
- Go to
chrome://net-internals/#sockets(or the Edge equivalent) and click Flush socket pools.
The socket step matters more than most guides admit. Open keep-alive connections to the old IP can outlive a cache clear, and flushing the pools forces new connections to the fresh address. Restart the browser afterward if the tab still misbehaves.
Check Firefox or Opera for a Separate DNS Cache
In Firefox, open about:networking#dns and click Clear DNS Cache. The same page lists each cached hostname and its addresses, so you can check whether Firefox holds the stale IP before you clear it.
Opera is Chromium-based and uses opera://net-internals/#dns with the same Clear host cache button. Keep DNS over HTTPS in mind as well. If a browser has DoH turned on, it resolves names through its own provider and bypasses your OS resolver entirely, so a lookup that looks right from the command line can still come back different in the browser.
Distinguish a Browser DNS Cache from a Browser Cache
The two caches store different things:
- Browser DNS cache: hostname-to-IP mappings. Clear it when the site points at the wrong server.
- Browser cache: HTML, scripts, and images. Clear it when the right server returns outdated-looking content.
If a page shows old styling after a deploy, you are dealing with the browser cache. If you get DNS_PROBE_FINISHED_NXDOMAIN or land on your old host, the DNS layer is the problem. A hard refresh (Ctrl+Shift+R) fixes the first case and does nothing for the second.
What If the Website Still Does Not Resolve?

If flushing didn’t help, the fault is upstream of your machine: a DNS record that is wrong everywhere, a resolver still serving an old answer, or a network setting that is broken. Compare your local result against outside resolvers to find out which.
Compare Local Results with an External DNS Lookup
Run a lookup against your default resolver and against a public one:
nslookup yourdomain.comnslookup yourdomain.com 1.1.1.1dig @8.8.8.8 yourdomain.com Aon macOS or Linux
If the public answers match the IP address you expect but your default resolver disagrees, your ISP or router is still holding the old record. If every resolver returns the wrong address, the DNS records themselves need fixing at your DNS host. An NXDOMAIN you didn’t expect points to a missing record or a zone error.
A browser-based DNS lookup from outside your network gives you a clean comparison that no local cache can affect.
Check DNS Propagation and the Resolver You Are Using
After a record change, resolvers keep the old answer until its TTL expires. Flushing your own machine cannot speed up anyone else’s resolver. A DNS propagation checker shows which regions have picked up the new value. When most locations show it and yours doesn’t, switch resolvers to test.
Google Public DNS uses 8.8.8.8 and 8.8.4.4, and Cloudflare DNS uses 1.1.1.1 and 1.0.0.1, as this DNS troubleshooting walkthrough lists. Your home router also caches answers, so reboot it if your devices use it as their DNS server.
Investigate Server Errors, Network Settings, and Security Concerns
- DNS server not responding: first confirm you have connectivity with a ping test to 8.8.8.8. Then work through the DNS server not responding fixes.
- Bad DHCP lease: on Windows, run
ipconfig /release, thenipconfig /renew, to pull fresh DNS server settings. - VPN or firewall: both can intercept port 53. Disconnect and test again.
- DNS spoofing: if a well-known domain resolves to an unfamiliar IP on your network but correctly everywhere else, treat it as a security incident, not a cache glitch.
For the full process, see our guide to network troubleshooting.
Use a Fresh Lookup to Confirm the Fix
A flush is only finished once you have verified it. The OS command clears the local cache: ipconfig /flushdns on Windows, the combined dscacheutil and mDNSResponder line on a Mac, and resolvectl flush-caches on Linux. After that, clear the host cache in Chromium-based browsers and in Firefox.
Next, check that your machine now returns the same IP address that an external lookup shows. If the two match, the cache was the problem and it is fixed. If they don’t, the cause sits upstream: your router, your ISP’s resolver, propagation, or the DNS records themselves. The comparison steps above will narrow down which. Keep a note of the correct IP for each critical domain so you can confirm a fix in seconds the next time you need to flush the DNS cache.

Leave a Reply