# How to Flush DNS Cache (Windows, macOS, Linux)

> How to flush the DNS cache on Windows, macOS and Linux — the exact commands (ipconfig /flushdns, dscacheutil, resolvectl), when to do it, and how to verify it worked.

- Page URL: https://itinsighthub.com/guides/flush-dns-cache/
- Markdown variant of this page: append `?format=md` to any URL on this site or send `Accept: text/markdown`.
- Full site index for AI assistants: https://itinsighthub.com/llms.txt
- Full site export: https://itinsighthub.com/llms-full.txt

# How to Flush DNS Cache

The exact commands to clear the local DNS cache on Windows, macOS and Linux — and when flushing actually helps.

Published August 29, 2026

The short version: Windows → ipconfig /flushdns · macOS → sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder · Linux (systemd) → sudo resolvectl flush-caches. On many Linux systems there is no cache to flush unless a resolver like systemd-resolved or dnsmasq is running.

## What the DNS cache actually is

Every time your machine looks up a hostname, the operating system (or a local resolver) remembers the answer for a while so the next lookup is instant. That memory is the **DNS cache**, and each entry lives only as long as its TTL allows — anywhere from a minute to a day, set by the domain owner.

Flushing clears that memory and forces the next lookup to ask a DNS server again. It is the DNS equivalent of "turn it off and on again": harmless, quick, and often the first thing to try when a name resolves wrong.

## Windows

Flush the cache in an elevated Command Prompt or PowerShell

```
ipconfig /flushdns
```

You will see `Successfully flushed the DNS Resolver Cache.` Two companion commands are worth knowing: `ipconfig /displaydns` lists what is currently cached (useful to confirm a stale entry), and `ipconfig /registerdns` re-registers the machine's own DNS records.

The flush applies to the Windows DNS Client service; there is no need to restart anything. It is the same command on Windows 10, Windows 11 and Windows Server.

## macOS

Flush the cache (you will be prompted for your password)

```
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
```

macOS has used `mDNSResponder` as its resolver for years, so these two commands cover every modern version from El Capitan (10.11) through the current macOS. The first clears the `dscacheutil` cache, the second restarts the responder process that actually serves lookups. Some older guides still show `discoveryutil` commands from the brief 10.10 window — ignore those; `mDNSResponder` is correct now.

## Linux

Linux is the only platform where the answer is "it depends", because glibc itself does *not* cache DNS — caching comes from whichever local resolver is installed. Find what is running, then flush that:

*Flush command by resolver*

| Resolver | Flush command | Typical on |
| --- | --- | --- |
| systemd-resolved | sudo resolvectl flush-caches | Ubuntu, Fedora, Debian 12+, most systemd distros |
| dnsmasq | sudo systemctl restart dnsmasq | Routers, dnsmasq-as-resolver setups |
| nscd | sudo nscd -i hosts | Older or minimal installs running nscd |
| (none) | nothing to flush | bare systems with no local resolver |

Find which resolver is in charge

```
# Is systemd-resolved active?
systemctl is-active systemd-resolved

# Which DNS server is actually answering?
resolvectl status

# Or check what listens on port 53 locally:
sudo ss -tulpn | grep ':53'
```

If nothing is listening on port 53 and no resolver is active, there is no cache on the machine — the query goes straight to the configured upstream server, so there is nothing to flush.

## When flushing actually helps

- **After changing a domain's DNS.** You moved a site to a new host and it still shows the old IP — your machine may be holding the old answer.
- **After editing the hosts file.** Some resolvers cache negative results, so a name that used to fail can stay "not found" for a while.
- **Troubleshooting a name that resolves on your phone but not your laptop.** Different devices, different caches.

Flushing will **not** help if the problem is on the server side — if the authoritative DNS still serves the old record, or if propagation has not finished. Use a fresh resolver to check what the world sees: `nslookup example.com 1.1.1.1` or `dig +short example.com @8.8.8.8`.

## How to verify it worked

Look up a name against a specific server to bypass any remaining cache

```
# Windows
nslookup example.com

# macOS / Linux
dig +short example.com

# Bypass local cache by asking a public resolver directly
dig +short example.com @1.1.1.1
```

If you changed a record recently, the authoritative answer may still take a few minutes to propagate regardless of your local cache — that is the domain's own TTL, not your machine's cache.

## Frequently asked questions

**Is flushing DNS cache safe?**

Yes, completely. It clears a temporary local cache only — nothing about your network configuration or files. The cache simply rebuilds itself as you browse. The worst effect is that the next few lookups are marginally slower while entries re-populate.

**Why is my browser still showing the old site after flushing?**

Browsers keep their own DNS cache and their own page cache. After flushing the OS cache, also clear the browser's cache (or use an incognito window), and check the authoritative answer with `dig +short example.com @1.1.1.1` to see whether the change has actually propagated.

**How long does DNS cache last?**

Each record carries its own TTL set by the domain owner, commonly 300 seconds to 24 hours. The OS cache respects that TTL, so entries expire on their own — flushing just forces immediate expiry.

**Do I need administrator rights to flush DNS?**

On Windows, `ipconfig /flushdns` requires an elevated Command Prompt or PowerShell. On macOS and Linux the `sudo` commands prompt for your password. These are all read-and-flush operations, not persistent changes.

## Related references

- [How to check open ports](https://itinsighthub.com/guides/check-open-ports/) — the networking counterpart for troubleshooting.
- [Common TCP/UDP ports](https://itinsighthub.com/common-ports/) — an IANA-checked reference table.
- [PowerShell one-liners](https://itinsighthub.com/powershell/one-liners/) — includes `Clear-DnsClientCache` and `Resolve-DnsName`.

---

© 2026 ITInsightHub · [About](https://itinsighthub.com/about/) · [Contact](https://itinsighthub.com/contact/) · [Privacy](https://itinsighthub.com/privacy/)
