
Flush DNS on Windows: ipconfig /flushdns and Elevation Fix
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 /flushdnsUse 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:
- Press the Windows key, type cmd (or PowerShell), and open it.
- Run
ipconfig /flushdns. - Wait for "Successfully flushed the DNS Resolver Cache."
- Verify resolution with
ping -n 1 myproject.testoripconfig /displaydns. - 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:
- 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.
- Accept the UAC prompt.
- Run
ipconfig /flushdnsagain.
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-DnsClientCacheInspect 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:
- Right-click the desktop and choose New, then Shortcut.
- Enter
cmd /k ipconfig /flushdnsand name it "Flush DNS". - 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\hostsbut 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 10Get-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
| Command | What it does |
|---|---|
ipconfig /displaydns | Lists the cached DNS records |
ipconfig /registerdns | Refreshes DHCP leases and re-registers DNS names |
ipconfig /release then ipconfig /renew | Drops the IP address and requests a new one from DHCP |
ipconfig /all | Shows the DNS servers each network adapter uses |
Verify the result
ipconfig /displaydns
ping -n 1 myproject.testIf 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(oredge://net-internals/#dns) and click Clear host cache. Otherwise restart the browser. - Firefox: open
about:networking#dnsand 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:
- Run
ipconfig /alland check which DNS servers the active adapter uses. A VPN or a second adapter may take over. - Test with another resolver, for example 1.1.1.1 or 8.8.8.8, to rule out your router or provider.
- As a last resort, run
netsh winsock resetfrom 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>hostnamewith nohttp://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 runwsl --shutdownfrom 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
Hosts File Location on Windows 11 and How to Edit It (2026)Editing the hosts file
Hosts File Location on Windows 11 and How to Edit It (2026)
9 min read
How to Flush DNS Cache on Windows, macOS & Linux (2026)Flushing DNS & cache
How to Flush DNS Cache on Windows, macOS & Linux (2026)
8 min read
Flush DNS on macOS Sonoma (14): Exact Command (2026)Flushing DNS & cache
Flush DNS on macOS Sonoma (14): Exact Command (2026)
2 min read