User Agents

Web browsers and everyday web tech, explained

How to Fix DNS Cache: Clear It on Any Device

· 5 min read · Cookies and Cache

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Clearing your DNS cache removes outdated or incorrect website address records stored by your device, which can resolve issues like websites failing to load, showing old content, or displaying connection errors. When your browser or operating system caches DNS (Domain Name System) entries, it speeds up browsing by remembering where websites are located. However, if those records become stale or corrupted—such as after a website changes servers or during network troubleshooting—your device may try to reach an outdated address. Flushing the DNS cache forces your system to look up fresh DNS information, restoring proper access. This guide walks you through clearing the DNS cache on Windows, macOS, Linux, Android, and iOS, with practical steps, common pitfalls, and troubleshooting advice.

What You'll Need

  • Administrator or root access (for Windows, Linux, or macOS)
  • Command-line or terminal access (for desktop operating systems)
  • Internet connection (to verify results after clearing)
  • Device restart may be required in some cases

Step-by-Step

  1. Identify your operating system: The method for clearing DNS cache varies by OS. Confirm whether you're using Windows, macOS, Linux, Android, or iOS before proceeding.
  2. On Windows (10 and 11): Press Windows + R, type cmd, and press Enter. In the Command Prompt, type ipconfig /flushdns and press Enter. You should see a message saying "Successfully flushed the DNS Resolver Cache."
  3. On macOS (Ventura and later): Open Terminal (found in Applications > Utilities). Enter sudo dscacheutil -flushcache and press Enter. Then run sudo killall -HUP mDNSResponder to ensure the cache is fully cleared. Enter your admin password when prompted.
  4. On older macOS (Monterey and earlier): Use the same Terminal and run sudo killall -HUP mDNSResponder. No separate dscacheutil command is needed.
  5. On Linux (Ubuntu/Debian-based): Most distributions use systemd-resolved. Open a terminal and run sudo systemd-resolve --flush-caches. If that command fails, check your distribution’s DNS service—some use dnsmasq or unbound, which may require restarting the service instead.
  6. On Android: There is no direct user-accessible DNS cache flush. Instead, go to Settings > Network & Internet > Wi-Fi, tap the connected network, and select "Forget". Then reconnect. Alternatively, restarting the device often clears cached DNS entries.
  7. On iOS: Like Android, iOS does not offer a manual DNS flush. Turn on Airplane Mode for 10 seconds, then turn it off. Alternatively, restart the device to clear temporary network caches, including DNS.
  8. Verify the fix: After clearing the cache, open a browser and try loading a previously problematic website. To confirm fresh DNS lookup, use a tool like nslookup (Windows/macOS/Linux) or an online DNS checker to see if updated records are now being used.

Common Mistakes

  • Not using administrator privileges: On Windows and macOS, failing to run Command Prompt or Terminal as an administrator will result in "Access Denied" errors. Always launch with elevated permissions.
  • Using outdated commands: Some guides recommend ipconfig /flushdns on macOS, but this command does not exist there. Use the correct Terminal commands based on your OS version.
  • Confusing browser cache with DNS cache: Clearing your browser history or cache does not flush the system DNS cache. Both may need to be cleared separately if loading issues persist.
  • Expecting instant results: DNS changes can take time to propagate. Even after flushing your local cache, upstream DNS servers (like your ISP’s) may still serve old records for minutes or hours.
  • Skipping verification: Failing to test after clearing the cache may leave you uncertain whether the fix worked. Always confirm by visiting the affected site or using a DNS lookup tool.

Tips

  • Clear DNS after changing networks: When switching from home to public Wi-Fi or using a VPN, flushing DNS can prevent routing conflicts.
  • Use public DNS for better reliability: Consider switching to Google DNS (8.8.8.8) or Cloudflare (1.1.1.1) to reduce reliance on potentially slow or outdated ISP DNS servers.
  • Combine with browser cache clear: For persistent website issues, clear both DNS and browser cache to eliminate all local stored data.
  • Restart your router occasionally: Routers also cache DNS. A reboot can help if multiple devices are experiencing the same issue.
  • Check for malware: Some malicious software alters DNS settings. After clearing the cache, verify your DNS server settings haven’t been hijacked.

Troubleshooting

If the DNS flush doesn’t resolve the issue, consider these steps:

  • Command not recognized: On Linux, if systemd-resolve fails, your system may use a different DNS manager. Check with ps aux | grep dns to identify the service, then restart it (e.g., sudo systemctl restart dnsmasq).
  • Website still not loading: The problem may not be local. Use a DNS lookup tool online to see if the domain resolves correctly from other locations. If not, the issue is with the website or its DNS provider.
  • No internet after flush: Rarely, misconfigured DNS settings can cause this. Reset network settings or manually set a public DNS server.
  • Flush succeeds but problem returns quickly: This may indicate a deeper network issue, such as a rogue DHCP server or router misconfiguration. Restart your router and check its DNS settings.
  • Permission denied errors: On macOS or Linux, ensure you’re using sudo. On Windows, right-click Command Prompt and select "Run as administrator".

Frequently Asked Questions

Does clearing DNS cache delete saved passwords?

No. DNS cache only stores website addresses, not login data or form information.

How often should I clear my DNS cache?

Only when troubleshooting connection issues. Routine clearing is unnecessary and may slightly slow browsing temporarily.

Can clearing DNS improve internet speed?

Indirectly. If old DNS records cause failed connections or redirects, flushing can restore faster access, but it doesn’t boost overall bandwidth.

Is it safe to flush DNS cache?

Yes. It’s a standard troubleshooting step with no risk to your system or data.

Why doesn’t Android have a DNS flush command?

Android abstracts low-level network functions. The OS automatically manages DNS, so manual control isn’t exposed to users.

Does restarting my device clear DNS cache?

Yes, in most cases. A full reboot typically clears temporary network caches, including DNS.