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. Here are the exact commands, Chrome's own cache and a way 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. 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 /flushdns in an admin Command Prompt, or Clear-DnsClientCache in 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-caches for systemd-resolved, nscd -i hosts for nscd, or send a SIGHUP to dnsmasq.
  • Chrome keeps its own host cache. Clear it at chrome://net-internals/#dns too.
  • 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 hosts file 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

  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

For 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. 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.

  1. Open Applications > Utilities > Terminal.
  2. Run:
bash
sudo killall -HUP mDNSResponder
  1. 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 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

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.

bash
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

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

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 tells you 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 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):

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, clear that cache too:

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

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

  1. Wait out the TTL. Check the record's TTL with the DNS lookup tool so you know how long that takes.
  2. Ask a public resolver directly while you test, 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 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.

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