# How to Flush DNS on Windows 11 and 10 (ipconfig /flushdns)

To flush DNS on Windows 10 or Windows 11, open Command Prompt or Terminal and run `ipconfig /flushdns`. In PowerShell, `Clear-DnsClientCache` does the same thing, and Microsoft's [cmdlet reference](https://learn.microsoft.com/en-us/powershell/module/dnsclient/clear-dnsclientcache) says running it is equivalent to running `ipconfig /flushdns`.

The flush only clears one layer: the Windows DNS client cache. It does nothing to your router, your DNS provider, your browser's own DNS cache or your network adapters, so it fixes a stale name lookup and very little else. The rest of this post covers when that layer is actually the problem, how to look inside it, the heavier reset commands people pair it with and what each of them changes.

## What the DNS client cache holds

Before an app connects to `example.com`, Windows has to turn that name into an IP address. The DNS Client service keeps the answers it has already received so that repeated lookups do not go back to the network every time. Microsoft's [ipconfig reference](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ipconfig) describes the cache as holding both entries preloaded from the local Hosts file and recently obtained records for names the computer has resolved, and says the service uses it "before querying its configured DNS servers."

Each record is kept for the time-to-live the domain's DNS server attached to it, then fetched again. Failures are cached too: the same reference says `/flushdns` can "discard negative cache entries," which are answers saying a name does not exist. That is why a site that failed once can keep failing on one PC while other devices reach it.

To see what is in the cache without changing anything:

```cmd
ipconfig /displaydns
```

Or in PowerShell, filtered to one name:

```powershell
Get-DnsClientCache -Entry example.com
```

[`Get-DnsClientCache`](https://learn.microsoft.com/en-us/powershell/module/dnsclient/get-dnsclientcache) can filter by record type, status (`Success`, `NotExist` or `NoRecords`) and time-to-live, which is easier to read than the long `ipconfig` listing. A `NotExist` entry for a name that should work is a cached failure.

## When flushing DNS helps

| Situation | Why the flush matters |
|---|---|
| A site or server moved to a new address and this PC still reaches the old one | The old record has not expired from the local cache yet |
| You changed the DNS server in Settings | Answers from the previous server are still cached |
| You edited the hosts file and the change seems ignored | The cache holds entries preloaded from the hosts file and earlier answers for that name |
| You switched a VPN or proxy on or off and some names still resolve to the wrong side | Records fetched through the other path are still cached |
| A local development domain points somewhere new | A cached answer, or a cached "does not exist," is being reused |
| One name fails here but works on your phone on the same network | A failed lookup may be cached as a negative entry |

In each case the cure is the same: flush, then check what Windows resolves now (see the verification section below), then retry the app. Quit and reopen the browser rather than only reloading the tab, for the reason in the next section.

## When flushing DNS will not help

The Windows cache is one of several places a name can be answered, and a flush touches only that one.

- **Your provider or the site is down.** If every site fails, or other devices on the same network fail too, the problem is upstream. Flushing changes nothing there.
- **Your router or DNS provider has the old record.** They cache answers as well. A local flush cannot make them fetch a new record sooner; that only happens when their copy expires.
- **The browser resolves names itself.** Chrome's [help page](https://support.google.com/chrome/answer/10468685?hl=en&co=GENIE.Platform%3DDesktop) says secure DNS is turned on by default in automatic mode, and Chromium-based browsers keep their own host resolver cache. Chromium's net-internals page has a "Clear host cache" button under "Host resolver cache" ([source](https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/resources/net_internals/index.html)). Open `chrome://net-internals/#dns` in Chrome or `edge://net-internals/#dns` in Edge and click it. The same page's Sockets section has "Flush socket pools," which Chromium labels "May break pages with active connections," so close important tabs first if you use it.
- **The DNS server setting itself is wrong.** If Windows is pointed at a server that answers wrongly or not at all, flushing just asks the same server again. Check it in Settings › Network & internet › Wi-Fi › Manage known networks (or Ethernet), select your network, then Edit next to IP assignment. Microsoft's [network settings page](https://support.microsoft.com/en-us/windows/essential-network-settings-and-tasks-in-windows-f21a9bbc-c582-55cd-35e0-73431160a1b9) says Automatic (DHCP) takes the DNS server address from your router or access point and recommends it. On a work PC with a VPN, changing this can break internal names, so ask whoever manages the PC first.
- **Pages are slow, not failing.** Lookups are cached precisely because they are quick to reuse. Slow downloads or stuttering video are rarely a DNS problem, and an empty cache makes the next few lookups slightly slower, not faster.

## Commands to flush and inspect the cache

In Command Prompt or Terminal:

```cmd
ipconfig /flushdns
ipconfig /displaydns
```

In PowerShell:

```powershell
Clear-DnsClientCache
Get-DnsClientCache
```

Neither Microsoft reference page lists an administrator requirement for these, and Mole for Windows runs the same flush from its normal, non-elevated process. If a managed PC answers with an access error, open Terminal or Command Prompt as administrator and run the command there. A flush deletes nothing on disk and needs no restart; the cache refills as apps look names up again.

Do not schedule flushes or add them to a startup script as a speed tweak. A warm cache is the fast path, and a fresh flush only helps when a specific record is wrong.

## Check the hosts file before blaming the cache

The hosts file overrides DNS for any name it lists. Microsoft's [hosts reset article](https://support.microsoft.com/en-us/windows/experience/how-to-reset-the-hosts-file-back-to-the-default) gives its folder as `%WinDir%\System32\Drivers\Etc`, typically `C:\Windows\System32\drivers\etc`. The file is called `hosts` with no extension. A default file contains only comment lines starting with `#` and, per that article, loopback mappings for `localhost`.

Development tools, ad blockers and old tutorials sometimes add lines here and leave them behind. If the misbehaving domain appears in the file, that line is why it resolves the way it does. To change it, keep a copy first (Microsoft's article renames the old one to `Hosts.old`), edit only the line you need in an editor run as administrator, save without adding a `.txt` extension, then run `ipconfig /flushdns` so the cache stops holding the old preloaded entry. Do not delete the file or change its permissions.

## Heavier resets and what they change

Microsoft's [Wi-Fi troubleshooting article](https://support.microsoft.com/en-us/windows/experience/connectivity-networking/fix-wi-fi-connection-issues-in-windows) lists these commands together, run in an administrator Command Prompt in this order:

```cmd
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns
```

They do very different things, and only the last one is about DNS:

- **`ipconfig /release`** sends a DHCP release and, according to the [ipconfig reference](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ipconfig), disables TCP/IP for adapters set to obtain an address automatically. You are offline until `/renew` gets a new address. Never run it alone over a remote desktop session.
- **`ipconfig /renew`** asks DHCP for a fresh configuration. It is available only on adapters set to obtain an address automatically.
- **`netsh winsock reset`** returns the Winsock catalog to a clean state, removing custom Layered Service Providers ([netsh winsock](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/netsh-winsock)). Some VPN clients and security tools install those providers, so check those apps afterwards.
- **`netsh int ip reset`** overwrites the TCP/IP and DHCP parameter keys in the registry, which Microsoft's [TCP/IP reset article](https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/reset-tcp-ip-net-shell) says has the same effect as removing and reinstalling TCP/IP. It needs administrator rights and a restart, and the sample log there shows static IP addresses, gateways and DNS servers being reset. If you set any of those by hand, write them down first.
- **Network reset** in Settings › Network & internet › Advanced network settings › Network reset removes every network adapter and its settings, then reinstalls them with defaults after the PC restarts. Microsoft's Wi-Fi article warns that you might need to reinstall and set up VPN client software or Hyper-V virtual switches, and that known networks might be set to the public network profile.

If the only symptom is one name resolving to an old or missing address, none of these are needed. Treat them as steps for a connection that is broken in general, after a flush and a check of the DNS server and hosts file have not explained it.

## Confirm the fix

1. Ask the cache only, to see what Windows is holding for the name:

   ```powershell
   Resolve-DnsName example.com -CacheOnly
   ```

   [`Resolve-DnsName`](https://learn.microsoft.com/en-us/powershell/module/dnsclient/resolve-dnsname) with `-CacheOnly` "resolves this query using only the local cache." Run it right after a flush and again after the app has retried, so you can see which answer was cached.

2. Resolve it normally, then once more skipping the hosts file, and compare:

   ```powershell
   Resolve-DnsName example.com
   Resolve-DnsName example.com -NoHostsFile
   ```

   If the two answers differ, a hosts file line is the cause.

3. Ask a DNS server directly. In the [nslookup reference](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/nslookup), the second argument is the server to query; without it, nslookup uses the default DNS name server.

   ```cmd
   nslookup example.com
   nslookup example.com 1.1.1.1
   ```

   If your configured server returns the old address and another server returns the new one, the old record is still cached upstream, and waiting is the fix. If both return the old address, the record has not changed yet.

4. Quit and reopen the browser or app that had the problem, and clear its host cache if it is Chrome or Edge.

## Where Mole fits

Mole for Windows includes "Flush DNS cache" in Optimize, in the network and search group. It calls the Windows `DnsFlushResolverCache` function, which clears the same Windows DNS client cache as `ipconfig /flushdns`, and it runs without an administrator prompt. The [Windows help page](/windows/help) lists it with Optimize's other maintenance, and [what Windows optimization does](/windows/blog/what-windows-optimization-does) explains how each task maps to a symptom.

That is the whole of Mole's network repair. It does not reset Winsock or TCP/IP, does not release or renew addresses, does not reinstall network adapters, and does not touch VPN connections, static addresses, the hosts file or a browser's own host cache. For those, use the commands above. If you came here because a browser feels slow rather than a name failing, browser storage is covered in the [Windows cache guide](/windows/blog/windows-cache-cleanup).

## FAQ

### How do I flush DNS on Windows 11?

Run `ipconfig /flushdns` in Command Prompt or Terminal, or `Clear-DnsClientCache` in PowerShell. Either one takes effect immediately and needs no restart.

### Does flushing DNS clear the Chrome or Edge DNS cache?

No. Open `chrome://net-internals/#dns` or `edge://net-internals/#dns` and click "Clear host cache," then reopen the browser.

### Is it safe to flush the DNS cache?

Yes. It only discards cached lookups, which Windows fetches again on the next request. The reset commands that are often listed next to it, like `netsh int ip reset` or Network reset, change much more and can remove static settings or VPN adapters.

### Why does a site still go to the old address after flushing?

Check the hosts file, your browser's own cache and whether `nslookup` against your DNS server still returns the old address. If the server or router still has the old record, a local flush cannot change it until that copy expires.


Canonical: https://mole.fit/windows/blog/flush-dns-windows
