Fix a DNS cache that is wrong
We'll confirm the wrong IP with dig or nslookup, flush the DNS cache on your OS, and verify resolution—or tell you when to change DNS or call support.
What you'll need
- Terminal or Command Prompt (with admin/sudo)
- The domain that resolves wrong
Step-by-step diagnostic
Quick triage — pick your path
Quick triage — pick your path
Choose the option that matches what you see. You can jump straight to that section.
- Follow this guide Work through the full procedure from confirm to flush.
- Windows — flush now You are on Windows and want to flush immediately.
- Mac — flush now You are on Mac and want to flush immediately.
- Linux — flush now You are on Linux and want to flush immediately.
- Verify with dig or nslookup You flushed and want to confirm the fix.
Show full guide
Steps
Goal: Confirm the wrong IP, flush the cache, and verify resolution.
- Run
dig example.comanddig @8.8.8.8 example.com(replace example.com with the domain). If the IPs differ, your DNS cache has the wrong value. - Good: Local resolution differs from 8.8.8.8—cache is the cause. Proceed to flush.
- Bad: Both match—check the hosts file or other causes.
Windows — flush
Goal: Clear the DNS cache on Windows.
- Open Command Prompt as Administrator (right-click, Run as administrator).
- Run
ipconfig /flushdns. You should see “Successfully flushed the DNS Resolver Cache.” - Good: Flush succeeds. Proceed to Verify.
- Bad: Error—ensure you ran as Administrator.
Mac — flush
Goal: Clear the DNS cache on Mac.
- Open Terminal. Run
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Enter your password when prompted. - No output usually means success. The cache is cleared.
- Good: Command completes. Proceed to Verify.
- Bad: Permission denied—ensure you have sudo access.
Linux — flush
Goal: Clear the DNS cache on Linux.
- If using systemd-resolved:
sudo systemctl restart systemd-resolved. - If using nscd:
sudo systemctl restart nscdorsudo service nscd restart. - Good: Service restarts. Proceed to Verify.
- Bad: Service not found—your distro may use a different resolver; check documentation.
Verify
Goal: Confirm the cache returns the correct IP after flush.
- Run
dig example.comornslookup example.comagain. The ANSWER section (dig) or output (nslookup) should show the correct IP. - Compare to
dig @8.8.8.8 example.com—they should match. - Good: IPs match. The cache is fixed.
- Bad: Still wrong—change DNS to 8.8.8.8 or 1.1.1.1, flush again, or call support.
When to get help
Contact your ISP or network admin if:
- Flush succeeds but resolution stays wrong.
dig @8.8.8.8shows the correct IP but your resolver keeps returning the wrong one (upstream DNS issue).- You cannot run admin or sudo commands and need help.
Verification
dig example.comanddig @8.8.8.8 example.comreturn the same IP.nslookup example.comshows the correct IP.- The site loads correctly in the browser.
Escalation ladder
Work from the device outward. Stop when the problem is fixed.
- Confirm wrong IP Use dig or nslookup to compare local vs 8.8.8.8.
- Flush cache ipconfig /flushdns (Windows), dscacheutil + mDNSResponder (Mac), or restart resolved/nscd (Linux).
- Verify Run dig or nslookup again—IP should match.
- Change DNS server Use 8.8.8.8 or 1.1.1.1 if cache keeps repopulating wrong.
- Call support ISP or network admin if resolution stays wrong.
What to capture if you need help
Before calling support or posting for help, have these ready. It speeds everything up.
- Domain that resolves wrong
- IP from dig/nslookup before flush
- IP from dig @8.8.8.8 (expected correct)
- OS and flush command used
- Steps already tried
Does dig or nslookup show the wrong IP?
Compare local resolution to a known-good resolver.
You can change your answer later.
Check hosts file or other causes
Which OS are you on?
Flush command differs by OS.
You can change your answer later.
Run as Administrator or with sudo
Does dig or nslookup show the correct IP now?
Verify the cache has fresh data.
You can change your answer later.
Change DNS server and flush again
DNS cache fixed
Reviewed by Blackbox Atlas
Frequently asked questions
- Why does the DNS cache return wrong results?
- The device stores DNS results locally to speed up lookups. When a site moves to a new IP or you change DNS records, the cache can hold the old IP until it expires or you flush it.
- How do I check what the DNS cache has?
- Use `dig example.com` or `nslookup example.com` to see what your system resolves. Compare to `dig @8.8.8.8 example.com` to see what Google DNS returns—if they differ, your cache may be wrong.
- Does flushing DNS cache affect anything else?
- No. Flushing only clears stored DNS results. The next lookup fetches fresh data from your DNS server. No data loss or connection change.
Rate this guide
Was this helpful?
Thanks for your feedback.