Your computer doesn't look up a domain's IP address fresh every single time you visit a site. It caches the result locally - trading speed for accuracy. Most of the time, that's fine. But when DNS records change and your machine is still pointing at the old IP, the cache becomes the problem.

Flushing the DNS cache forces your system to discard those stored records and fetch fresh ones from the DNS server. It takes three seconds and fixes more issues than you'd expect.

---

Windows - The Standard Fix

Open Command Prompt as Administrator (Win + S → type cmd → right-click → Run as administrator) and run:

Command
ipconfig /flushdns

You'll see:

Command
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.

That's it. Done. The cache is cleared, and your next DNS queries will be resolved fresh.

Need to confirm what's cached before flushing? Run this first:

Command
ipconfig /displaydns

This lists every DNS record currently stored locally - useful for verifying whether a specific domain is resolving to a stale address.

Want a full reset? Chain it with a DNS client service restart:

Command
ipconfig /flushdns
net stop dnscache
net start dnscache

This clears the cache and restarts the underlying Windows DNS Client service - the nuclear option when a basic flush doesn't stick.

---

macOS

Open Terminal and run the appropriate command for your macOS version:

Command
# macOS Ventura, Sonoma, Sequoia (13+)
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

# macOS Monterey (12)
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Enter your admin password when prompted. No confirmation message - silence means success.

---

Linux

Linux DNS caching varies by which resolver service is running:

Command
# systemd-resolved (Ubuntu 18.04+, most modern distros)
sudo systemd-resolve --flush-caches

# nscd (older systems)
sudo service nscd restart

# dnsmasq
sudo service dnsmasq restart

Not sure which one you're running? Check with:

Command
systemctl status systemd-resolved

---

When to Actually Flush DNS

Not every connection issue needs a DNS flush. Use it when:

Situation Why Flush Helps
Site loads an old version after migration Cached IP still points to old server
Domain recently transferred or updated TTL hasn't expired locally
Getting a "server not found" after DNS changes Stale record blocks resolution
VPN connected but sites won't resolve Conflicting cached records from pre-VPN session
Testing a new DNS record you just published Confirms propagation at the local level

---

What Flushing Doesn't Fix

Worth being clear: DNS flush only clears your machine's local cache. It does not:

  • Force your ISP's DNS servers to update (that's TTL-dependent)
  • Fix router-level DNS caching - reboot your router for that
  • Resolve issues caused by a misconfigured hosts file (C:\Windows\System32\drivers\etc\hosts)
  • Speed up global DNS propagation - that still takes time

If flushing doesn't solve the problem, check your DNS server settings (ipconfig /all) and verify the hosts file hasn't been tampered with.

---

Bottom line: ipconfig /flushdns on Windows is a 10-second fix that resolves a surprising number of "why won't this site load" problems. Run it before you start blaming the network.