Skip to main content
Blog|
How-to guides

How to Flush DNS Cache on Linux, Mac, and Windows

|
Mar 16, 2026|7 min read
HOW-TO GUIDESHow to Flush DNS Cache onLinux, Mac, and WindowsHOSTNEYhostney.comMarch 16, 2026

Your operating system caches DNS responses to avoid repeating the same lookups. When you visit a domain, the resolved IP address gets stored locally for a period of time defined by the record’s TTL (Time to Live). The next time you visit the same domain, your device uses the cached answer instead of querying the DNS server again.

This is normally a good thing – it makes DNS resolution faster and reduces load on DNS servers. But cached entries can cause problems when:

  • A website has moved to a new server and updated its DNS records, but your device is still sending traffic to the old IP
  • A DNS record was misconfigured and then fixed, but your device is still serving the broken cached answer
  • You are troubleshooting a DNS issue and need to ensure you are getting fresh responses rather than cached ones
  • You recently changed your DNS server and want to force fresh lookups through the new one immediately

Flushing the DNS cache discards all stored entries and forces your device to perform fresh lookups for every domain it visits next. It does not affect what other DNS resolvers around the world have cached – it only clears your local device’s cache.

If you are troubleshooting a DNS issue and want to verify what records a domain actually has right now, use SiteProbe’s DNS lookup tool to query authoritative nameservers directly rather than relying on any cached data.

How to flush DNS cache on Windows

Windows maintains a DNS resolver cache as part of the DNS Client service. Flushing it requires a single command.

Open Command Prompt as Administrator (search for “cmd”, right-click, Run as administrator) and run:

ipconfig /flushdns

You should see the message “Successfully flushed the DNS Resolver Cache.”

If you want to see what is currently in the cache before flushing:

ipconfig /displaydns

To verify the cache is empty after flushing:

ipconfig /displaydns

The output should show no entries or a minimal set.

Windows DNS cache after network changes

If you recently changed your DNS server settings and flushing the cache does not seem to take effect, also run:

ipconfig /release
ipconfig /renew

This releases and renews your IP address from DHCP, which also re-fetches your DNS server assignment. Follow with another flush:

ipconfig /flushdns

Flushing DNS cache on Windows Server

The same command works on Windows Server. On Server Core installations without a GUI, run it from an elevated PowerShell or Command Prompt session:

Clear-DnsClientCache

This is the PowerShell equivalent of ipconfig /flushdns and produces the same result.

How to flush DNS cache on Mac

macOS uses mDNSResponder to handle DNS caching. The flush command has changed across macOS versions – use the one that matches your version.

macOS Monterey, Ventura, Sonoma (12, 13, 14, 15)

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

This runs two commands in sequence. dscacheutil -flushcache clears the directory service cache, and killall -HUP mDNSResponder sends a hangup signal to the mDNSResponder process, causing it to reload and clear its DNS cache.

You will be prompted for your password. There is no confirmation message – if no error appears, the flush succeeded.

macOS Big Sur and earlier (11 and below)

sudo killall -HUP mDNSResponder

On older macOS versions, this single command is sufficient.

Verify the flush worked on Mac

macOS does not have a built-in command to display the DNS cache contents, so you cannot directly verify it is empty. The most reliable test is to try resolving a domain you know recently changed its DNS records:

dig example.com

Check the TTL value in the response. A freshly cached response will show the full TTL from the DNS record. If you are seeing a low TTL, the entry was already in your cache and is aging out.

How to flush DNS cache on Linux

Linux DNS caching depends on which service is managing it. Different distributions use different approaches.

systemd-resolved (Ubuntu 18.04+, Debian 10+, most modern distributions)

Check if systemd-resolved is active:

systemctl is-active systemd-resolved

If active, flush the cache with:

sudo resolvectl flush-caches

Verify the cache was cleared:

resolvectl statistics

Look for “Current Cache Size” – it should be 0 or very low after flushing.

Older versions of systemd-resolved use a different command:

sudo systemd-resolve --flush-caches

nscd (Name Service Cache Daemon)

nscd is used on some older distributions and those that do not use systemd-resolved. Check if it is running:

systemctl is-active nscd

If active, restart it to flush the cache:

sudo systemctl restart nscd

Or on systems without systemd:

sudo service nscd restart

dnsmasq

dnsmasq is commonly used on distributions that run it as a local DNS resolver, including some Ubuntu configurations and many router/server setups.

sudo systemctl restart dnsmasq

Or send it a SIGHUP signal to clear the cache without a full restart:

sudo killall -HUP dnsmasq

No DNS caching service

Some minimal Linux installations do not run a local DNS caching service at all. DNS queries go directly to the resolver specified in /etc/resolv.conf without local caching. In this case, there is no local cache to flush – each query is already going directly to the upstream resolver.

To check what resolver you are using:

cat /etc/resolv.conf

If it shows nameserver 127.0.0.53 , systemd-resolved is active. If it shows a direct IP like nameserver 1.1.1.1 or your router’s IP, queries are going directly to that server.

Ubuntu specifically

Ubuntu has used different DNS management across versions:

Ubuntu 22.04 and later:

sudo resolvectl flush-caches

Ubuntu 18.04 – 21.10:

sudo systemd-resolve --flush-caches

Ubuntu 16.04 and earlier (using dnsmasq):

sudo killall -HUP dnsmasq

If you are unsure which applies, try resolvectl flush-caches first – it works on all Ubuntu versions that use systemd-resolved and gives a clear error if the service is not running.

Flushing DNS cache in browsers

Browsers maintain their own internal DNS cache separate from the operating system cache. Flushing the OS cache does not clear the browser’s cache. If you are troubleshooting a DNS issue in a specific browser, flush its internal cache too.

Chrome and Chromium-based browsers (Edge, Brave, Opera)

Open a new tab and go to:

chrome://net-internals/#dns

Click “Clear host cache”. This clears Chrome’s internal DNS cache.

While you are there, you can also clear socket pools which helps if connections are being reused:

chrome://net-internals/#sockets

Click “Flush socket pools”.

Firefox

Firefox does not have a built-in DNS cache flush option in the UI. The simplest approach is to restart Firefox, which clears its in-memory DNS cache.

For a flush without restarting, open about:config, search for network.dnsCacheExpiration , and temporarily set it to 0. This disables caching. Set it back to the default (60) after testing.

When to flush DNS cache

Flush your DNS cache when:

  • A site you manage has moved to a new server and you need to verify the new IP is resolving correctly on your device
  • You are seeing a cached version of a site that should be showing updated content
  • A domain was recently registered and is not resolving even though DNS records are set up
  • You changed your DNS server settings and want fresh lookups through the new server immediately
  • You are troubleshooting DNS_PROBE_FINISHED_BAD_CONFIG or DNS server not responding errors and want to rule out cached bad entries

Do not expect flushing your local cache to fix DNS propagation issues for other people. Your local cache affects only your device. If other people around the world are still seeing an old IP for your domain after a migration, they need to wait for the TTL on their own resolvers to expire – you cannot flush their caches remotely.

For checking what DNS records exist right now from an authoritative source, independent of any cached data anywhere, use tools.hostney.com/dns. It queries the authoritative nameservers directly and shows you exactly what records are published.

Summary

Flushing DNS cache forces your device to discard locally stored DNS responses and perform fresh lookups. On Windows use ipconfig /flushdns in an elevated command prompt. On Mac run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. On Linux the command depends on your DNS service – sudo resolvectl flush-caches for systemd-resolved, sudo systemctl restart nscd for nscd, or sudo killall -HUP dnsmasq for dnsmasq. If you are troubleshooting a browser-specific DNS issue, also clear the browser’s internal DNS cache via chrome://net-internals/#dns in Chrome. Flushing your local cache only affects your device – DNS propagation to other resolvers worldwide depends on TTL expiry, not local cache flushes.