Explore WaseerHost

Appearance

GuideDomainsDNS 8 min read

ipconfig /flushdns: How to Flush DNS on Windows, Mac and Linux

Run ipconfig /flushdns on Windows, sudo killall -HUP mDNSResponder on a Mac, or resolvectl flush-caches on Linux. Exact commands, Chrome's cache and how to verify.

Waqas Ahmed Waseer, authorWaqas Ahmed WaseerFounder & CEO
Updated
ipconfig /flushdns: How to Flush DNS on Windows, Mac and Linux

Summarize with:

Share:

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 /flushdns in an admin Command Prompt, or Clear-DnsClientCache in PowerShell. Microsoft documents the two as equivalent.
  • Mac: sudo killall -HUP mDNSResponder for 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-caches for systemd-resolved, nscd -i hosts for nscd, or a SIGHUP for dnsmasq.
  • Chrome keeps its own host cache. Clear it at chrome://net-internals/#dns as 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 hosts file 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

  1. Click Start and type cmd.
  2. Right-click Command Prompt and choose Run as administrator.
  3. Run:
cmd
ipconfig /flushdns
  1. Look for the confirmation line: Successfully flushed the DNS Resolver Cache.

Using PowerShell

Open PowerShell as administrator and run:

powershell
Clear-DnsClientCache

Microsoft'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):

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

ipconfig /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.

  1. Open Applications > Utilities > Terminal.
  2. Run:
bash
sudo killall -HUP mDNSResponder
  1. 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 versionCommand (per Apple)
OS X 10.10.4 and later (all current macOS releases)sudo killall -HUP mDNSResponder
OS X 10.10 to 10.10.3sudo discoveryutil mdnsflushcache
OS X 10.7 to 10.9.5sudo killall -HUP mDNSResponder
Mac OS X 10.6 to 10.6.8sudo 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.

bash
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

How 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:

bash
sudo resolvectl flush-caches

The 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)):

bash
sudo nscd -i hosts

On 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):

bash
sudo killall -HUP dnsmasq

How 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:

  1. Type chrome://net-internals/#dns in the address bar.
  2. Click Clear host cache.
  3. Open chrome://net-internals/#sockets and 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.

SystemCommandWhat it shows
Windows (cmd)ipconfig /displaydnsContents of the DNS client resolver cache
Windows (PowerShell)Get-DnsClientCacheSame cache, as PowerShell objects
Linux (systemd-resolved)resolvectl statisticsResolver and cache statistics
Any systemnslookup example.comThe 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:

cmd
nslookup example.com
nslookup example.com 1.1.1.1

The 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:

  1. Wait out the TTL. Check the record's TTL with the DNS lookup tool so you know how long that is.
  2. Ask a public resolver directly for testing, as in the nslookup example above.
  3. 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.

Waqas Ahmed Waseer

Written by

Waqas Ahmed Waseer

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.

Related Guides

Get new guides by email

One short email when we publish something useful. No spam; unsubscribe at any time.

Free SSL · Free migration · 24/7 support

Find your domain

Search domains
30-day money-back guarantee

Renews at the same price for the term you choose