How to Flush Your DNS Cache

Run a Speed Test

The DNS cache stores recently resolved domain-to-IP mappings to speed up repeated lookups. When a domain's IP changes or a DNS error gets cached, flushing the DNS cache forces your device to fetch fresh records — fixing stale or incorrect resolutions.

What the DNS Cache Is and Why It Exists

Every time your device resolves a domain name to an IP address, the result is stored in a local DNS cache. The next time you visit the same domain, your device checks the cache first — if a valid entry exists, the lookup completes in under a millisecond without contacting any external DNS server. This caching dramatically reduces latency for frequently visited sites and reduces the load on DNS infrastructure worldwide.

Each cached entry has a TTL (Time To Live) — a countdown in seconds set by the domain owner — that determines how long the entry is considered valid. When the TTL expires, the cache discards the entry and the next lookup must go to the DNS server for a fresh answer. Most domains set TTLs between 300 seconds (5 minutes) and 86400 seconds (24 hours).

When the Cache Becomes a Problem

Caching is normally invisible and beneficial, but it causes problems in specific situations. The most common is a website that has migrated to a new server with a different IP address. If your device cached the old IP before the migration, it keeps sending requests to the old server — which may no longer exist — until the TTL expires. The site appears broken even though DNS is correctly updated globally.

A cached NXDOMAIN response is another common culprit. If you tried to visit a domain that did not exist yet (or had a temporary DNS outage), your resolver may have cached the "domain does not exist" answer. Even after the domain is properly configured, your device continues serving the cached negative response until it expires or until you flush the cache.

Other situations where flushing helps: after changing your configured DNS server (the old server's cached responses may differ from the new one), after editing your /etc/hosts or Windows hosts file (the OS cache takes precedence and may serve stale results), and after a domain owner fixes a broken DNS record that you had already cached.

Flush DNS Cache on Windows 10 and Windows 11

The process is identical on both Windows 10 and Windows 11. You must run the command with administrator privileges.

Open the Start menu, type cmd, right-click Command Prompt in the results, and select Run as administrator. In the elevated Command Prompt window, type the following command and press Enter:

ipconfig /flushdns

A successful flush displays: Windows IP Configuration — Successfully flushed the DNS Resolver Cache. No restart is required. To confirm the cache is empty, run ipconfig /displaydns immediately after — it should show no entries or a minimal set.

If DNS problems persist after flushing, also run netsh winsock reset in the same elevated Command Prompt, then restart your computer. This resets the Windows network stack at a deeper level than the DNS cache alone.

Flush DNS Cache on macOS (Ventura, Sonoma, Monterey)

macOS uses the mDNSResponder service to manage DNS caching. On macOS Ventura, Sonoma, and Monterey, the flush command is the same:

sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

Open Terminal (Applications → Utilities → Terminal), paste the command, press Enter, and enter your administrator password when prompted. The command produces no output on success — this is expected. The two parts work together: dscacheutil -flushcache clears the cache database, and killall -HUP mDNSResponder sends a signal to the mDNSResponder process to reload, completing the reset.

On older macOS versions (Big Sur and earlier), the same command works. On El Capitan and older, the command was sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder — functionally identical but using a semicolon rather than &&.

Flush DNS Cache on Ubuntu and Linux

Linux does not have a universal DNS cache — it depends on which DNS caching service is running on your system. On modern Ubuntu (18.04 and later) using systemd-resolved, the command is:

sudo systemd-resolve --flush-caches

To verify the flush, run sudo systemd-resolve --statistics and check that the "Current Cache Size" is zero or very low.

On systems using nscd (Name Service Cache Daemon), the command is:

sudo /etc/init.d/nscd restart

On systems using dnsmasq for caching, restart the service with sudo systemctl restart dnsmasq. If your Linux system uses none of these services, it performs no OS-level DNS caching, and only browser-level caches (covered below) need clearing.

Clear DNS Cache in Chrome

Chrome maintains its own internal DNS cache that is independent of the operating system cache. Flushing the OS cache does not clear Chrome's cache. To clear Chrome's DNS cache:

Open a new Chrome tab and navigate to chrome://net-internals/#dns. Click the Clear host cache button. For a more thorough reset, also navigate to chrome://net-internals/#sockets and click Flush socket pools — this clears cached TCP connections in addition to DNS entries.

Chrome caches DNS records for up to 60 seconds regardless of the record's TTL. After clearing the internal cache, the next navigation to any domain will trigger a full DNS lookup.

Clear DNS Cache in Firefox

Firefox also maintains its own DNS cache. By default it caches entries for 60 seconds. To clear it immediately, open a new tab and navigate to about:networking#dns. Click the Clear DNS Cache button at the top of the page.

You can also change how long Firefox caches DNS entries by navigating to about:config, searching for network.dnsCacheExpiration, and setting it to a lower value (in seconds) or to 0 to disable DNS caching in Firefox entirely. Setting it to 0 is useful during DNS debugging but slows down browsing since every domain requires a full lookup.

How to Verify the Flush Worked

After flushing, you can confirm that a fresh lookup is being performed using command-line tools. On Windows, run nslookup example.com twice — the first result comes from the DNS server (fresh), the second from cache. On macOS and Linux, use the dig command: dig example.com before and after flushing. The query time (shown as ;; Query time:) should be higher on the first post-flush query (network round-trip) and much lower on the second (cached). If both queries return the same low time, the cache was not fully cleared.

DNS Flush Commands by Platform

Platform Flush Command Notes
Windows 10 / 11 ipconfig /flushdns Run Command Prompt as Administrator
macOS Ventura / Sonoma / Monterey sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder Run in Terminal; no output on success
Ubuntu (systemd-resolved) sudo systemd-resolve --flush-caches Most Ubuntu 18.04+ systems
Linux (nscd) sudo /etc/init.d/nscd restart Older distros using nscd
Chrome (all platforms) Navigate to chrome://net-internals/#dns → Clear host cache Also flush socket pools for full reset
Firefox (all platforms) Navigate to about:networking#dns → Clear DNS Cache Default TTL is 60 seconds

Frequently Asked Questions

Does flushing DNS cache fix website not loading?

Flushing the DNS cache fixes website loading problems caused by stale or incorrect cached DNS records. If your device cached an old IP address after a site moved to a new server, or cached an NXDOMAIN response for a domain that has since been set up correctly, flushing forces a fresh DNS lookup that retrieves the current correct record. However, if the website is genuinely down or has a DNS misconfiguration on its end, flushing your cache will not help because the problem is not local to your device.

How do I flush DNS on Windows 11?

To flush DNS on Windows 11, open the Start menu and search for "Command Prompt", then right-click it and choose "Run as administrator". In the elevated Command Prompt window, type ipconfig /flushdns and press Enter. You should see the message "Successfully flushed the DNS Resolver Cache." No restart is required. The flush takes effect immediately for new DNS lookups.

What is the DNS flush command on Mac?

On macOS Ventura and Sonoma (and Monterey), the DNS flush command is: sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder. Open Terminal, paste this command, press Enter, and enter your administrator password when prompted. The command produces no output on success — that is normal behavior. The two parts together clear the DNS cache and signal the mDNSResponder process to reload, ensuring both the cache and the resolver are reset.

Does flushing DNS cache delete passwords or cookies?

No. Flushing the DNS cache only clears cached domain-name-to-IP-address mappings. It does not affect browser cookies, saved passwords, browsing history, browser cache (images, scripts, stylesheets), or any other stored data. After flushing, you will still be logged into websites and all your saved credentials will remain intact. The only effect is that your next visit to a domain will trigger a fresh DNS lookup instead of using a cached result.

How do I clear DNS cache in Chrome?

Chrome maintains its own internal DNS cache separate from the operating system. To clear it, open a new Chrome tab and navigate to chrome://net-internals/#dns. Click the "Clear host cache" button. For a more thorough reset, also go to chrome://net-internals/#sockets and click "Flush socket pools". These steps clear both the DNS cache and any cached TCP connections, ensuring Chrome establishes fresh connections to sites.

How often should I flush my DNS cache?

You do not need to flush your DNS cache on any regular schedule — the cache automatically expires entries based on each record's TTL (Time To Live) value. Flush your DNS cache only when you have a specific reason: a website is not loading and you suspect a stale DNS record, you just changed your DNS server, you modified your hosts file, or a domain you own recently migrated to a new server and you want to see the updated IP immediately. Routine flushing provides no benefit and just means the next lookup for every domain must go to the DNS server instead of being served from cache.

Related Guides

More From This Section