Windows OS • Beginner • 4 min read

How to Flush DNS Cache in Windows 11 and Windows 10 (Complete Guide)

Summary

Learn how to completely flush and reset the DNS resolver cache in Windows 11 and 10 using Command Prompt and PowerShell. Fix stale records and connectivity issues.

Companion Tool
Common Network Ports & Services Reference Guide

Search and inspect TCP and UDP network ports, protocols, and standard services. Quick reference lookup for firewalls, networking, and system security.

Open tool

Why You Need to Flush the DNS Cache

When you visit any website, your Windows operating system stores the domain name and corresponding IP address in a local temporary storage database known as the DNS Resolver Cache.

While this caching mechanism significantly speeds up subsequent page requests by skipping the external DNS lookup cycle, stale or poisoned records can cause serious headaches:

  • Stale Server IP: If a web application moves to a new web server or hosting provider, Windows may continue attempting to reach the decommissioned IP until the Time-To-Live (TTL) counter expires.
  • DNS Spoofing / Poisoning: Malicious programs or network MITM attacks may attempt to inject bogus records redirecting your web traffic to phishing replicas.
  • ERR_NAME_NOT_RESOLVED: Frequent connection timeouts occur when old cache entries conflict with active DHCP network configurations.

Flushing the cache clears all cached IP records and forces your computer to request fresh, authoritative records directly from your configured DNS nameservers.


Method 1: Using Administrator Command Prompt (Standard Way)

This is the universal method that works across Windows 11, Windows 10, Windows 8, and Windows Server:

  1. Press Win + R on your keyboard to open the Run dialog.
  2. Type cmd and press Ctrl + Shift + Enter together to launch Command Prompt directly in Administrator Mode.
  3. In the command prompt window, type:
    ipconfig /flushdns
  4. Press Enter. You will see the standard confirmation:
    Windows IP Configuration
    
    Successfully flushed the DNS Resolver Cache.

Method 2: Using PowerShell (Modern Administrator Way)

If you are using modern Windows PowerShell or PowerShell 7:

  1. Right-click the Windows Start menu button (or press Win + X) and select Terminal (Admin) or PowerShell (Admin).
  2. Run the native PowerShell cmdlet:
    Clear-DnsClientCache
  3. Unlike ipconfig, PowerShell executes the command silently. To inspect your DNS cache before and after clearing, you can use:
    # View all active cached DNS records:
    Get-DnsClientCache
    
    # Clear the cache:
    Clear-DnsClientCache

How to Verify What is Currently in Your DNS Cache

Curious which domains Windows has cached in your local memory right now?

In Command Prompt, execute:

ipconfig /displaydns | more

This dumps every recorded domain name, record type (such as Type 1 for IPv4 A records or Type 28 for IPv6 AAAA records), and the remaining Time To Live (TTL) countdown in seconds. Press Spacebar to scroll through entries, or press Ctrl + C to exit.


Automating DNS Flush on System Startup (Optional)

If your development workflow regularly involves switching local hosts files or editing staging domains, you can create a one-click desktop shortcut:

  1. Right-click any empty space on your desktop and select New > Shortcut.
  2. In the target location box, enter:
    cmd.exe /c ipconfig /flushdns
  3. Click Next, name the shortcut Flush DNS, and click Finish.
  4. Right-click the new shortcut, go to Properties > Advanced, and check Run as administrator. Now you can double-click this shortcut anytime to refresh your network stack in 1 second.

Related reference