
To flush DNS on Windows, open Command Prompt as an administrator and run ipconfig /flushdns. On a current Mac, run sudo killall -HUP mDNSResponder in Terminal, and on most modern Linux desktops run sudo resolvectl flush-caches. This guide gives the exact command for each system, shows how to check that the flush worked, and explains when flushing helps.
Key takeaways
- Windows:
ipconfig /flushdnsin an admin Command Prompt, orClear-DnsClientCachein PowerShell. Microsoft documents the two as equivalent. - Mac:
sudo killall -HUP mDNSResponderfor OS X 10.10.4 and later, per Apple's own support note. - Linux: the command depends on which caching service you run:
resolvectl flush-cachesfor systemd-resolved,nscd -i hostsfor nscd, or aSIGHUPfor dnsmasq. - Chrome keeps its own host cache. Clear it at
chrome://net-internals/#dnsas well. - Flushing only clears your device. It can't speed up a nameserver change on your ISP's resolver; that depends on each record's TTL.
What the DNS cache is and why you flush it
Every time you visit a site, your computer asks a DNS resolver to turn the name into an IP address, then keeps the answer for a while. Microsoft describes the Windows resolver cache as holding "entries preloaded from the local Hosts file and any recently obtained resource records," so repeat visits skip the lookup (Microsoft Learn: ipconfig).
How long an answer stays is set by its TTL. RFC 1035 defines TTL as "the time interval that the resource record may be cached before the source of the information should again be consulted."
That cache becomes a problem when the real answer changes before the TTL runs out. Common cases:
- You moved a website to a new host and the domain now points to a new IP.
- You changed your domain's nameservers.
- You edited your
hostsfile and want the change picked up. - A site failed to load once, and your computer cached the failure. Microsoft notes that flushing lets you "discard negative cache entries."
How to flush DNS on Windows (ipconfig /flushdns)
These steps work on Windows 10 and Windows 11 and follow cPanel's documentation and Microsoft's command reference.
Using Command Prompt
- Click Start and type
cmd. - Right-click Command Prompt and choose Run as administrator.
- Run:
ipconfig /flushdns- Look for the confirmation line: Successfully flushed the DNS Resolver Cache.
Using PowerShell
Open PowerShell as administrator and run:
Clear-DnsClientCacheMicrosoft's reference says this cmdlet "deletes all the contents of the DNS client cache" and that running it "is equivalent to running ipconfig /flushdns" (Microsoft Learn: Clear-DnsClientCache). It prints nothing when it succeeds.
Flush DNS and renew your IP address
If you are fixing a wider connection problem, Microsoft's Wi-Fi troubleshooting guide runs these commands in order from an administrator Command Prompt (Microsoft Support):
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdnsipconfig /release drops your current DHCP address, so expect the connection to go down until /renew finishes.
How to flush DNS on Mac
Apple's support note "Reset the DNS cache in OS X" lists the command by version (Apple Support). Apple has archived that page, but it is still the vendor's own reference, and cPanel's documentation gives the same command for macOS 10.10.4 and later.
- Open Applications > Utilities > Terminal.
- Run:
sudo killall -HUP mDNSResponder- Enter your Mac's administrator password when asked. The password doesn't appear as you type, and there's no output when the command succeeds.
| macOS version | Command (per Apple) |
|---|---|
| OS X 10.10.4 and later (all current macOS releases) | sudo killall -HUP mDNSResponder |
| OS X 10.10 to 10.10.3 | sudo discoveryutil mdnsflushcache |
| OS X 10.7 to 10.9.5 | sudo killall -HUP mDNSResponder |
| Mac OS X 10.6 to 10.6.8 | sudo dscacheutil -flushcache |
You'll often see the combined version below. The extra dscacheutil -flushcache part clears the Directory Service cache, which macOS's man dscacheutil page says "should only be used in extreme cases." It does no harm, but on current macOS the mDNSResponder command is the one Apple lists for DNS.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderHow to flush DNS on Linux
Linux has no single DNS cache. Which command you need depends on the caching service your distribution runs, so flush the one you have.
systemd-resolved (Ubuntu and most current distributions)
Check that it is active first. resolvectl status "shows the global and per-link DNS settings currently in effect" (resolvectl man page). Then flush:
sudo resolvectl flush-cachesThe man page says this "flushes all DNS resource record caches the service maintains locally." cPanel gives the same command for Ubuntu.
nscd
nscd caches several databases, including hosts. Its man page says to run nscd -i <database> to invalidate a cache (nscd(8)):
sudo nscd -i hostsOn CloudLinux and AlmaLinux, cPanel's guide restarts the service instead: systemctl restart nscd.
dnsmasq
The dnsmasq manual says that when it receives a SIGHUP it "clears its cache and then re-loads" its hosts files (dnsmasq man page):
sudo killall -HUP dnsmasqHow to clear Chrome's DNS cache
Chrome keeps its own host cache, separate from the operating system's. If one site still misbehaves in Chrome after a system flush:
- Type
chrome://net-internals/#dnsin the address bar. - Click Clear host cache.
- Open
chrome://net-internals/#socketsand click Flush socket pools, so open connections to the old IP are dropped.
Both buttons are defined in Chromium's net-internals page source (Chromium source).
How to check that the flush worked
Run one of these commands to confirm the cache is empty.
| System | Command | What it shows |
|---|---|---|
| Windows (cmd) | ipconfig /displaydns | Contents of the DNS client resolver cache |
| Windows (PowerShell) | Get-DnsClientCache | Same cache, as PowerShell objects |
| Linux (systemd-resolved) | resolvectl statistics | Resolver and cache statistics |
| Any system | nslookup example.com | The address your resolver returns now |
Right after a flush, ipconfig /displaydns should list little more than your hosts file entries. Then look up the domain you care about:
nslookup example.com
nslookup example.com 1.1.1.1The second line asks Cloudflare's public resolver directly, a form shown in Microsoft's nslookup reference. If your computer and the public resolver return the same new IP, your device is up to date. To see the records your domain publishes right now, run it through the WaseerHost DNS lookup tool.
When flushing your own cache isn't enough
Flushing clears your computer, not the resolver it asks. If your ISP's resolver cached the old record, it keeps serving it until the TTL expires. You have three options:
- Wait out the TTL. Check the record's TTL with the DNS lookup tool so you know how long that is.
- Ask a public resolver directly for testing, as in the
nslookupexample above. - Purge the public resolver's cache. Google Public DNS has a Flush Cache page, and Google advises: "If the registrar or DNS hosting for a domain changed recently, flush the main domain name first before flushing subdomains." Cloudflare offers the same for 1.1.1.1 with its Purge Cache tool. These only refresh those two services, not every resolver on the internet.
If you just registered a domain or are pointing one at new hosting, set the nameservers at your registrar first. You can register or manage domains here, then flush and test.
Frequently asked questions
It empties the Windows DNS client resolver cache. Microsoft's reference says it "flushes and resets the contents of the DNS client resolver cache," including negative entries for names that failed to resolve. Your next visit to each site triggers a fresh lookup.

Written by
Founder & CEO
Founder and CEO of Wasevo LLC, the company that runs WaseerHost. He works on cPanel/WHM servers, WHMCS billing and the Next.js storefront.


