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.
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.
ipconfig /flushdns
The /flushdns switch clears all entries in the Windows DNS Resolver Cache. For persistent issues, also run ipconfig /registerdns to re-register DNS entries.
sudo killall -HUP mDNSResponder
For macOS High Sierra or Mojave, use: sudo killall -HUP mDNSResponder && sudo dscacheutil -flushcache
sudo systemd-resolve --flush-caches
If using nscd instead of systemd-resolved, use: sudo /etc/init.d/nscd restart. On Arch Linux: sudo systemctl restart systemd-resolved
Toggle Airplane Mode On → Off
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.
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:
chrome://net-internals/#dnsabout:networking#dnsedge://net-internals/#dnsDevelop menuAfter 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.
After clearing stale cache entries, consider switching to a privacy-focused, encrypted DNS resolver to prevent future cache poisoning and ISP-level DNS hijacking:
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.
DNS cache entries can become corrupted by network interruptions, causing incorrect or partial IP mappings that fail to resolve.
Malware or ISP-level injection may have poisoned your cache with false IP mappings that redirect traffic to malicious or incorrect servers.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.