
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. On most modern Linux desktops, run sudo resolvectl flush-caches. This guide gives the exact command for each system, shows how to check the result, and explains when a flush helps and when it doesn't.
Key takeaways
- On Windows, run
ipconfig /flushdnsin an admin Command Prompt, orClear-DnsClientCachein PowerShell. Microsoft documents the two as equivalent. - On a Mac with OS X 10.10.4 or later, run
sudo killall -HUP mDNSResponder. Apple's support note lists this command. - On Linux, the command depends on the caching service you run. Use
resolvectl flush-cachesfor systemd-resolved,nscd -i hostsfor nscd, or send aSIGHUPto dnsmasq. - Chrome keeps its own host cache. Clear it at
chrome://net-internals/#dnstoo. - A flush clears only your device. It can't speed up a nameserver change on your ISP's resolver, because each record's TTL controls that.
What the DNS cache is and why you flush it
When you visit a site, your computer asks a DNS resolver to turn the name into an IP address and 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).
The record's TTL decides how long the answer stays. 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."
The cache causes trouble when the real answer changes before the TTL runs out. That happens in a few 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 your computer to pick up the change. - A site failed to load once, and your computer cached the failure. Microsoft notes that a flush lets you "discard negative cache entries."
How to flush DNS on Windows (ipconfig /flushdns)
These steps work on Windows 10 and Windows 11. They 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
For 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. Your connection stays down until /renew finishes.
How to flush DNS on Mac
Apple's support note "Reset the DNS cache in OS X" lists the command for each 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 Terminal asks. The password doesn't appear as you type, and the command prints nothing when it 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 |
Many guides show the combined version below. The extra dscacheutil -flushcache part clears the Directory Service cache, and macOS's man dscacheutil page says it "should only be used in extreme cases." It does no harm, but on current macOS Apple lists only the mDNSResponder command for DNS.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderHow to flush DNS on Linux
Linux has no single DNS cache. The command depends on the caching service your distribution runs, so flush the one installed on your machine.
systemd-resolved (Ubuntu and most current distributions)
Check that the service 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 tells you 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 with systemctl restart nscd.
dnsmasq
The dnsmasq manual says that when dnsmasq 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, clear that cache too:
- Type
chrome://net-internals/#dnsin the address bar. - Click Clear host cache.
- Open
chrome://net-internals/#socketsand click Flush socket pools. This drops open connections to the old IP.
Chromium's net-internals page source defines both buttons (Chromium source).
How to check that the flush worked
Check the result instead of assuming it.
| 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. Microsoft's nslookup reference shows this form. 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
A flush clears your computer, not the resolver it asks. If your ISP's resolver cached the old record, it keeps serving that record 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 takes.
- Ask a public resolver directly while you test, 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 tools refresh only 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 starts 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.


