Skip to content
Flush DNS on Windows: ipconfig /flushdns and Elevation Fix

Flush DNS on Windows: ipconfig /flushdns and Elevation Fix

Updated 5 min read

Flush the DNS cache on Windows 10 and 11 with ipconfig /flushdns or PowerShell, and fix "The requested operation requires elevation" when it appears.

Need to flush the DNS cache on Windows right now? Open Command Prompt or PowerShell and run:

ipconfig /flushdns
How many times will you retype this command this month?Automate it with ToggleHosts

Use it after editing the hosts file, changing DNS servers, testing a migration, or when a domain still resolves to an old IP address. Need every platform in one place? See how to flush the DNS cache on Windows, macOS and Linux.

How to flush DNS on Windows 10 and 11

To flush DNS on Windows, run ipconfig /flushdns from Command Prompt or PowerShell:

  1. Press the Windows key, type cmd (or PowerShell), and open it.
  2. Run ipconfig /flushdns.
  3. Wait for "Successfully flushed the DNS Resolver Cache."
  4. Verify resolution with ping -n 1 myproject.test or ipconfig /displaydns.
  5. Reload the page in a fresh browser tab.

If Windows returns an elevation or access error, reopen the terminal with Run as administrator.

The same command works on Windows 10 and Windows 11.

Fix: "The requested operation requires elevation"

This message means the terminal is not running as administrator. Reopen it elevated and run the command again:

  1. Press Windows + X and choose Terminal (Admin) on Windows 11, or Windows PowerShell (Admin) on Windows 10. You can also search cmd, right-click Command Prompt, and pick Run as administrator.
  2. Accept the UAC prompt.
  3. Run ipconfig /flushdns again.

If you see "Could not flush the DNS Resolver Cache: Function failed during execution" instead, the DNS Client service is usually not running. Open services.msc, check that DNS Client is running, restart the PC if it is stopped, and try again.

Flush DNS with PowerShell (Clear-DnsClientCache)

If you prefer PowerShell, it ships a native cmdlet that does the same job as ipconfig /flushdns:

Clear-DnsClientCache

Inspect what is cached before you clear it with Get-DnsClientCache. Both cmdlets are convenient in scripts and CI runners where you automate a DNS reset.

Make a one-click shortcut

If you flush often, a shortcut saves the typing:

  1. Right-click the desktop and choose New, then Shortcut.
  2. Enter cmd /k ipconfig /flushdns and name it "Flush DNS".
  3. Open the shortcut's Properties, click Advanced, and tick Run as administrator.

Windows asks for the UAC approval each time you use it, which is the point: the command needs elevation.

When to flush DNS on Windows

  • You edited C:\Windows\System32\drivers\etc\hosts but the browser still opens the old site.
  • You switched DNS resolvers (Cloudflare 1.1.1.1, Google 8.8.8.8, a VPN).
  • You moved a staging site to a new server before DNS propagation.

For the full editing workflow, see how to edit the hosts file on Windows.

What flushing clears, and what it does not

Windows keeps a DNS Client cache in memory. It holds the answers it received and also the lookups that failed. ipconfig /flushdns empties that cache, so the next lookup asks the DNS server again or reads the hosts file. This is why a name that failed once keeps failing until you flush.

It does not clear the browser's own cache, an application's cache or your router's cache. That is why an old address can survive in Chrome after a successful flush.

Look inside the cache

Get-DnsClientCache | Where-Object Entry -like "*myproject*"
Get-DnsClientCache | Select-Object Entry, Data -First 10

Get-DnsClientCache lists the cached names, record types and data. Run it before and after the flush to see the difference.

Other ipconfig commands you may need

CommandWhat it does
ipconfig /displaydnsLists the cached DNS records
ipconfig /registerdnsRefreshes DHCP leases and re-registers DNS names
ipconfig /release then ipconfig /renewDrops the IP address and requests a new one from DHCP
ipconfig /allShows the DNS servers each network adapter uses

Verify the result

ipconfig /displaydns
ping -n 1 myproject.test

If the command line resolves correctly but the browser does not, the browser is caching the old result. Do not use nslookup for hosts entries: it queries DNS servers directly and never reads the hosts file.

Clear the browser DNS cache too

  • Chrome / Edge: when available, open chrome://net-internals/#dns (or edge://net-internals/#dns) and click Clear host cache. Otherwise restart the browser.
  • Firefox: open about:networking#dns and click Clear DNS Cache.

Reload in a new tab after clearing the browser cache.

When flushing is not enough

If the wrong answer comes back after a flush, work through these in order:

  1. Run ipconfig /all and check which DNS servers the active adapter uses. A VPN or a second adapter may take over.
  2. Test with another resolver, for example 1.1.1.1 or 8.8.8.8, to rule out your router or provider.
  3. As a last resort, run netsh winsock reset from an elevated prompt and restart the PC. It resets the network socket catalog and can remove entries added by some VPN or security software, so keep it for stubborn cases.

Troubleshooting

  • "The requested operation requires elevation": reopen the prompt as administrator.
  • Change still ignored: confirm the hosts line is IP<space>hostname with no http:// or port, then flush again.
  • Only one app affected: restart that app; some keep long-lived connections.
  • WSL2 still resolves the old IP: WSL2 keeps its own resolver, separate from Windows. Inside the distro run sudo resolvectl flush-caches, or run wsl --shutdown from Windows to restart it cleanly.

If you switch local domains often, a visual hosts manager like ToggleHosts edits the file safely and flushes DNS for you, avoiding malformed lines and forgotten flushes. Compare the Windows options, free and paid.

Prefer a one-click demo on Windows 11?

How to Flush DNS on Windows 11 Without Command Prompt (One Click) · @ToggleHosts_app

_Last tested: June 2026 on Windows 11 23H2 and Windows 10 22H2._

Sources and further reading

Frequently Asked Questions

Open Command Prompt or PowerShell and run ipconfig /flushdns. It clears the Windows DNS resolver cache.

Start with your usual Command Prompt or PowerShell. If Windows returns an access error, reopen it as administrator; managed devices can also require elevation.

The command ran in a terminal without administrator rights. Reopen Command Prompt or PowerShell with Run as administrator, accept the UAC prompt, and run ipconfig /flushdns again.

You will see "Successfully flushed the DNS Resolver Cache." Verify resolution with ipconfig /displaydns or ping yourdomain.test. nslookup queries DNS servers directly and skips the hosts file.

Related Articles

© 2026 ToggleHosts · All rights reserved[email protected]