DNS & OptimizationLow Severity

How to Flush DNS Cache: Complete Commands for All Platforms (2026)

Flushing your DNS cache forces your operating system and browser to discard stale or corrupted domain-to-IP mappings and fetch fresh records. This guide provides exact commands for Windows, macOS, Linux, Android, and all major web browsers — fixing DNS resolution errors, wrong redirects, and slow site loading in under two minutes.

Flush DNS Cache by Operating System

Each operating system maintains its own DNS resolver cache. Select your platform below for the exact commands and step-by-step instructions. Always run these commands with administrator or sudo privileges.

WindowsWindows 10 / 11
ipconfig /flushdns
  1. Press Win + S, type Command Prompt
  2. Right-click and select Run as Administrator
  3. Type: ipconfig /flushdns and press Enter
  4. Confirm: 'Successfully flushed the DNS Resolver Cache'
  5. Optionally run: netsh winsock reset (then reboot)

The /flushdns switch clears all entries in the Windows DNS Resolver Cache. For persistent issues, also run ipconfig /registerdns to re-register DNS entries.

macOSMonterey / Ventura / Sonoma (12–14)
sudo killall -HUP mDNSResponder
  1. Open the Terminal app (Applications → Utilities → Terminal)
  2. Type the command and press Enter
  3. Enter your Mac administrator password when prompted
  4. No output is shown on success — close and reopen your browser

For macOS High Sierra or Mojave, use: sudo killall -HUP mDNSResponder && sudo dscacheutil -flushcache

LinuxUbuntu / Debian / Fedora (systemd-resolved)
sudo systemd-resolve --flush-caches
  1. Open your terminal emulator
  2. Run the flush command for your resolver stack
  3. Verify the cache was cleared: sudo systemd-resolve --statistics
  4. Restart your browser to clear its in-memory DNS table

If using nscd instead of systemd-resolved, use: sudo /etc/init.d/nscd restart. On Arch Linux: sudo systemctl restart systemd-resolved

AndroidAndroid 9+
Toggle Airplane Mode On → Off
  1. Open Settings → Network & Internet → Private DNS
  2. Set Private DNS to Off, then back to Automatic
  3. Alternatively, toggle Airplane Mode on for 5 seconds then off
  4. Open Chrome → chrome://net-internals/#dns → Clear host cache

Android does not have a direct terminal DNS flush command without root. The most reliable method is using Chrome's built-in DNS cache flush.

Clear DNS Cache in Web Browsers

Browsers maintain their own in-process DNS cache separate from the OS. Even after an OS flush, the browser may continue serving stale records. Clear the browser DNS cache using its internal tools:

Google Chromechrome://net-internals/#dns
  1. Type chrome://net-internals/#dns in the address bar
  2. Click the 'Clear host cache' button
  3. Navigate to chrome://net-internals/#sockets and click 'Close idle sockets'
  4. Reload the affected page
Mozilla Firefoxabout:networking#dns
  1. Type about:networking#dns in the address bar
  2. Click 'Clear DNS Cache' button at the top right
  3. Alternatively restart Firefox — it clears the in-memory DNS table on launch
Microsoft Edgeedge://net-internals/#dns
  1. Type edge://net-internals/#dns in the address bar
  2. Click 'Clear host cache'
  3. Also visit edge://net-internals/#sockets → Close idle sockets
Safari (macOS)Develop menu
  1. Enable the Develop menu: Safari → Preferences → Advanced → Show Develop menu
  2. Click Develop in the menu bar
  3. Select 'Empty Caches' to clear all cached content including DNS

What Happens After Flushing?

After a successful DNS flush, your device's resolver cache is empty. The next time you visit any website, your OS will query your configured DNS resolver (ISP default or a public resolver like 1.1.1.1) to obtain a fresh IP mapping. This is completely normal and takes milliseconds.

The first few page loads after a flush may feel slightly slower as each domain is re-resolved. The cache will rebuild automatically as you browse, restoring the speed benefit within minutes.

If DNS errors persist after flushing, the problem may be upstream at your ISP's resolver or router level. Try switching to a public DNS like Cloudflare (1.1.1.1) or Google DNS (8.8.8.8) in your network settings.

Improve DNS Security After Flushing

After clearing stale cache entries, consider switching to a privacy-focused, encrypted DNS resolver to prevent future cache poisoning and ISP-level DNS hijacking:

Cloudflare
1.1.1.1 / 1.0.0.1
Privacy + Speed
Google DNS
8.8.8.8 / 8.8.4.4
Reliability
Quad9
9.9.9.9 / 149.112.112.112
Security

Related DNS Guides

Quick Fix Checklist

  • 1Open Command Prompt (Windows) or Terminal (Mac/Linux) with administrator privileges
  • 2Run the appropriate flush command for your OS (see guide below)
  • 3Clear browser-specific DNS cache via chrome://net-internals/#dns (Chrome)
  • 4Restart your browser after flushing to clear in-memory lookup tables
  • 5Test with nslookup or ping to verify the domain resolves to the correct IP
  • 6Restart your router if OS and browser flushes do not resolve the issue

Common Root Causes

Stale Cached IP Addresses

A website or server has moved to a new IP address, but your OS is still directing requests to the old address stored in cache.

Corrupted Cache Entries

DNS cache entries can become corrupted by network interruptions, causing incorrect or partial IP mappings that fail to resolve.

DNS Hijacking Artifacts

Malware or ISP-level injection may have poisoned your cache with false IP mappings that redirect traffic to malicious or incorrect servers.

Development / Testing Conflicts

Developers often need to flush DNS after pointing a domain to a new server IP, as the old IP is cached and blocks staging environment access.

Step-by-Step Diagnostic Resolution Flow

  1. 1

    Identify the OS / Browser Causing the Issue

    DNS caches exist at three separate levels: the operating system, the web browser, and the router. Identify which level holds the stale record by testing the domain on a different browser or device. If the issue appears in one browser only, clear the browser DNS cache first.

    Expert Tip: Open a Private / Incognito tab. If the site loads there, the issue is browser-level caching.
  2. 2

    Run the Flush DNS Command

    Execute the correct flush command for your OS (see the guide below). On Windows you need an elevated Command Prompt. On macOS the command varies by OS version. On Linux the service name depends on the resolver stack in use.

    Expert Tip: After flushing, close and reopen your browser to clear its in-memory lookup table.
  3. 3

    Clear Browser-Level DNS Cache

    Web browsers maintain their own DNS cache independent of the OS. Even after an OS flush, a browser can serve stale records for minutes. Visit the browser's hidden internal settings page to force a clear.

    Expert Tip: Chrome: chrome://net-internals/#dns — click 'Clear host cache'. Firefox: restart after about:config network.dnsCacheExpiration → 0.
  4. 4

    Verify Resolution is Fixed

    After flushing, use the nslookup or dig command to confirm the domain now resolves to the correct IP. If the IP still points to a stale address, the record may be cached at the router or ISP level.

    Expert Tip: Run: nslookup yourdomain.com 8.8.8.8 — to bypass local caches and query Google's resolver directly.

Expert Q&A & Troubleshooting Insights

What does flushing the DNS cache do?

Flushing the DNS cache deletes all locally stored domain-to-IP mappings. This forces your OS and browser to query your DNS resolver for fresh records on the next request. It fixes errors caused by changed IP addresses, corrupted entries, or DNS hijacking artifacts.

How often should I flush my DNS cache?

There is no set schedule. Flush your DNS cache when you experience issues like websites not loading despite a working connection, being redirected to wrong pages, or receiving DNS resolution errors after a domain's IP address has recently changed.

Does flushing DNS improve speed?

Temporarily, flushing DNS will slow down the first visit to each website since your device must re-resolve every domain from scratch. However, if stale cache entries were causing slow lookups or repeated retries, flushing can restore normal resolution speed.

Will flushing DNS log me out of websites?

No. DNS flushing only removes cached IP mappings — it does not affect browser cookies, session tokens, saved passwords, or login states. You will remain logged into all websites.

What is the Windows command to flush DNS?

Open Command Prompt as Administrator and run: ipconfig /flushdns. You should see a confirmation: 'Successfully flushed the DNS Resolver Cache.' If this command fails, also try: netsh winsock reset followed by a system reboot.

How do I flush DNS on Mac?

On macOS Monterey, Ventura, and Sonoma (macOS 12–14), open Terminal and run: sudo killall -HUP mDNSResponder. On older versions like High Sierra and Mojave: sudo killall -HUP mDNSResponder && sudo dscacheutil -flushcache.

How do I clear DNS cache in Chrome?

Type chrome://net-internals/#dns in the Chrome address bar, then click the 'Clear host cache' button. You can also click the 'Close idle sockets' button on chrome://net-internals/#sockets to force Chrome to re-establish connections.

Is it safe to flush DNS?

Yes, flushing the DNS cache is completely safe. It removes only temporary lookup records from memory. No files are deleted, no settings are changed, and no personal data is affected. The cache will rebuild automatically as you browse.