GuidesChapter 6 · Hosting & Domains

Hosting & Domains

Flush DNS Command: Clear Your DNS Cache on Any Device

The flush DNS command clears stale records after a host or domain change. Get Windows, Mac, Linux, and browser steps, plus how to verify the flush worked.

A hand hovers over a laptop keyboard on a tidy white desk, with synced mobile devices and a plant nearby.

In short

The flush DNS command clears your device’s saved domain-to-address lookups so it asks DNS for fresh information instead of reusing an outdated answer. The command varies by operating system and, on Linux, by the DNS service; browsers may also keep a separate host cache that needs clearing. Flushing can help after a site or host move, but it cannot speed up DNS changes across the whole internet, so verify the new address and check other caches or settings if the old site remains.

Think about moving house and having the mail keep arriving at the old address for weeks. After you move hosts or point a domain somewhere new, your computer can do the same thing, knocking on a door that’s already empty.

That habit comes from the DNS cache. DNS, short for Domain Name System, is the internet’s address book: it turns a name like yourdomain.com into the server address that holds your site.

Your device saves those answers so it doesn’t have to look them up every time. Running the flush DNS command empties that saved list so your device asks fresh questions.

Below, we’ll cover Windows, macOS, Linux and browsers, then show you how to confirm the flush worked and what to try if the old site still shows up.

Why the Flush DNS Command Clears Cache

Why would clearing memory fix a site that won’t load? Flushing wipes a short-term record of where websites live.

What your DNS cache stores

The Domain Name System (DNS) works like a phone book, turning a site’s name into a numeric Internet Protocol (IP) address. Your browser and operating system each keep a DNS cache, a local store of recent domain-to-IP mappings.

That store makes repeat visits faster, since your device skips the lookup. Does flushing delete browsing history? No. The cache holds only those lookups, not the pages you’ve visited.

What a stale or corrupted cache breaks

The cache is meant to be a shortcut, not a source of truth. If a host moves your site, an old record can linger, leaving pages stuck, browsing sluggish, or connectivity looking broken.

Outdated or corrupted records can also expose you to phishing and spoofing. According to a research paper on DNS cache poisoning, the attack “aims to redirect traffic from legitimate websites to malicious ones.”

What is DNS propagation, and does flushing help?

After a host or domain move, new records take time to spread. That spread is DNS propagation, and networks don’t all update at the same speed.

Flushing can help you troubleshoot here. It makes your machine ask again instead of trusting the old answer, so the change can arrive sooner. It won’t fix propagation for the whole internet, but it clears your copy.

You don’t need to flush routinely, though. Each cached record carries a time to live (TTL), a timer for how long it stays valid.

According to RFC 8499, the DNS terminology document, the TTL “specifies the time interval that the resource record may be cached before the source of the information should again be consulted.”

A woman replaces a faded address card on her door with a new one while an hourglass sits nearby.

How one client fixed missing CDN assets

Take a small online shop owner who moved to a new host and saw product images and style files fail to load. Those files come through a content delivery network (CDN), a set of servers that delivers files from locations near each visitor.

They checked the domain with the whatsmydns tool, which shows how it resolves around the world, then cleared their local DNS cache. The assets loaded, and the shop looked right again.

Run the Flush DNS Command on Windows

On Windows, you’ll type the command into a text window called Command Prompt. This section shows you how to open it and confirm the flush worked, which clears your computer’s saved copy of website addresses, called the DNS cache.

Open Command Prompt as administrator

Click the Start menu and search for cmd, and Command Prompt will appear in the results. Right-click that result and choose Run as administrator instead of a plain open.

The exact clicks vary a little by Windows version, so if your menu looks different, look for the same Run as administrator option.

Think of a bakery owner who just moved her shop site to a new host and keeps seeing the old page on her own laptop.

Once Command Prompt is open as administrator, she pastes in ipconfig /flushdns, and her computer can look up the new address instead of clinging to the old one.

Copy the command, paste it into the window, and press Enter. It’s harmless, so trying it won’t break anything on your machine.

Confirming the ipconfig /flushdns result

The command is the same on Windows 10, 8, 7 and XP, so you won’t need a different line for your version. When it works, Windows prints a success message after the command runs, and that message is your real proof.

Seeing it matters more than typing the command. Check for it every time.

Clearing the DNS Cache on a Mac

Your Mac keeps a DNS (domain name system) cache, a saved record of the addresses it has already looked up. After you move a domain or host, that record can still point to the old place, so clearing it helps the new site appear.

The steps are quick, but the command depends on your macOS version.

Open Terminal and check your macOS version

Use either route to open Terminal:

  • Spotlight search: open it and type Terminal.
  • Go > Utilities: in Finder, choose Go > Utilities, then open Terminal.

When Terminal asks for it, enter your admin password. Then check your macOS version from the Apple menu by choosing About This Mac. Version first, command second. The right command depends on your version, not on whichever tip you read last.

Pick the command for your macOS version

Each release calls for its own command, so match yours first:

  • Newer versions: use the combined command, which runs dscacheutil -flushcache and killall -HUP mDNSResponder in one line.
  • Yosemite: use discoveryutil, the tool built for that release.
  • Leopard: use lookupd, the tool built for that release.

Why Terminal shows no confirmation message

When the command works, Terminal shows no confirmation message, so a quiet screen isn’t a failure. You’ll know it worked by what the site does, not by what Terminal prints.

Test it by revisiting the site. A bakery owner who just moved her shop to a new host runs the command, sees nothing, and worries she broke something. She reloads her shop page instead, sees the new site, and gets back to baking.

If the old site still appears, run the command again and reload. Quiet doesn’t mean broken.

A woman in a bakery smiles at her laptop, which displays code and a website.

Clearing DNS Cache on Linux Systems

Linux has no single flush command, because the Domain Name System (DNS) cache lives in whichever service your system runs.

Finding out which DNS service runs

Run sudo lsof -i :53 (short for list open files) to see which program answers on port 53. Then confirm it with systemctl status. You’ll usually see one of these:

  • systemd-resolved: a resolver built into many modern Linux systems
  • dnsmasq: a lightweight resolver common on home networks
  • nscd: the Name Service Cache Daemon
  • BIND: the Berkeley Internet Name Domain server

The real question is which service holds the old address, since flushing the wrong one doesn’t change anything. For example, a wedding photographer whose gallery just moved sees dnsmasq listed, flushes it, and her clients see the new gallery.

Use these commands on systemd systems

If systemd-resolved is running, these are your options:

  1. Run sudo resolvectl flush-caches, the newer command.
  2. On older systems, use sudo systemd-resolve --flush-caches.
  3. Restart with sudo systemctl restart systemd-resolved, which briefly stops the service.
  4. Send the USR2 signal with sudo kill -USR2 $(pidof systemd-resolved) to flush without restarting.

Flushing leaves the service running. Restarting works too, but it’s heavier. A shop owner who switched hosts the night before a launch usually needs only the first command to see her new storefront. Start gentle.

Handling nscd, dnsmasq, BIND, and other distros

  • nscd: sudo systemctl restart nscd empties its cache.
  • dnsmasq: sudo systemctl restart dnsmasq does the same.
  • BIND: sudo rndc flush empties its cache, using rndc (remote name daemon control) to send the command.
  • Other distros: some include a dns-clean command for this job.

Afterward, reload your site to confirm the new address appears.

Clearing the Cache Inside Your Browser

After you move hosts or domains, your browser can keep sending you to the old address from its own saved list, so the new site never shows up. Here’s how to clear that list, browser by browser.

Open the net-internals page in your browser

Chrome has a built-in page for its network tools. Type chrome://net-internals/#dns into the address bar, and you’ll see the host cache, a saved list of Domain Name System (DNS) entries that match domain names to servers.

Edge and Opera have their own versions of this page, with the address changed to match the browser’s name. Firefox keeps its DNS tools elsewhere, so check its settings rather than guessing at an address.

Here’s the whole process:

  1. Click the Clear host cache button.
  2. Close the browser completely, then reopen it.

Think of a wedding photographer who moves her portfolio to a new host on Friday. On Saturday, Chrome still shows the old server, and she assumes the move failed.

Clearing the host cache and restarting gets her the new site in a few clicks, so she can send the right link to her clients.

A wedding photographer sits at a desk, clicking "Clear host cache" on her laptop to load her new portfolio website.

Why Safari works differently

Safari has no separate DNS page, so there’s no host cache button to press. Instead, it uses a system-level cache, a saved copy kept by your computer rather than by the browser.

So a Safari fix is about your computer, not your browser, and you’ll use the operating system steps covered elsewhere in this guide. Don’t go hunting for a Safari button. It isn’t there.

Checking the Flush and Fixing Problems

Flushing is only half the job. Here’s how to confirm the Domain Name System (DNS) is serving fresh answers.

Checking that the flush actually worked

Look past whether the flush ran to what answer you get. On Linux, systemctl status shows whether the DNS service is running, and journalctl shows its recent logs. For a direct test, run nslookup (a tool that asks DNS for a domain’s address).

If it returns your new host’s address, you’re set. Last, reload the site in your browser.

What to do when the flush fails

  • Command not found. Double-check the spelling and the terminal you’re using.
  • Resolution still failing. Check your hosts file, a local list that can pin a domain to an old address, and any stored answers at your router or a public DNS service.
  • Check resolv.conf. On Linux, this file lists the DNS server you’re asking, so see if it still names the old one. On Windows or macOS, find the DNS field in your network settings.
  • Restart NetworkManager. On Linux, this service manages your connection, so restarting it picks up new settings.

Consider a bakery owner whose laptop kept showing her old site after a host move. An old hosts file entry was the culprit, and removing it loaded the new page. Small fix, big relief.

Other errors like DNS server not responding

A “DNS server not responding” message means your computer got no reply. To fix it, swap the current address in your network settings for your provider’s or a public DNS service you trust, and flush again.

304 and SPDY errors usually point to your browser holding onto old copies, not to DNS. A 304 means a stored copy is being reused, and SPDY is an older web connection method. Clear your browser’s cache and reload.

Flushing the DNS cache is one of the quickest fixes after a host or domain move, and it takes just a few keystrokes. Each system has its own version, but the goal is always the same: stop trusting old answers and ask for current ones.

If the old site still appears, check the browser cache too, and give changes some time to spread. Work through the checks in order, and you’ll know exactly where things stand.

Clear the old memory, and your site shows up right where you sent it.

References

  1. DNS Cache Poisoning: Investigating Server and Client-Side Attacks and Mitigation Methods — doi.org (2023)
  2. RFC 8499: DNS Terminology — rfc-editor.org (2019)

Questions

What is DNS propagation?

DNS propagation is the time it takes for updated DNS records to become available across different networks and DNS resolvers. Flushing your device’s DNS cache makes it request a fresh answer, but it does not speed up propagation across the entire internet.

What is chrome \\ net Internals \# DNS?

`chrome://net-internals/#dns` is a Chrome page for network tools that displays the browser’s DNS host cache. Use its **Clear host cache** button to remove saved domain-to-server entries, then close and reopen Chrome.

What is the difference between DNS and IP address?

DNS is the system that translates domain names, such as `example.com`, into IP addresses. An IP address is the numeric network address of a device or server; DNS helps people reach it using a readable name.

How do I flush the DNS cache on Linux?

Linux uses different DNS caching services, so first identify the one running, for example with `sudo lsof -i :53` and `systemctl status`. Then use the matching command, such as `sudo resolvectl flush-caches` for systemd-resolved, `sudo systemctl restart nscd` for nscd, or `sudo systemctl restart dnsmasq` for dnsmasq.

How do I check my current DNS server?

On Linux, check `/etc/resolv.conf` to see which DNS server is configured, though some systems manage this file automatically. On Windows or macOS, look for the DNS field in your network settings; you can also use a command such as `nslookup` to see which server answers a DNS query.

How do I clear the DNS host cache in net Internals?

In Chrome, enter `chrome://net-internals/#dns` in the address bar and click **Clear host cache**. Then close Chrome completely and reopen it so the browser can request fresh DNS answers.

How can I fix a problem with the DNS cache?

First confirm you used the right flush command for your operating system and DNS service, then reload the site or test the domain with `nslookup`. If the problem remains, check for an outdated entry in your hosts file, router or DNS settings, and verify that your configured DNS server is responding. You can also restart the relevant DNS service or network connection.

Does flush DNS delete history?

No. Flushing DNS removes cached domain-to-IP lookups, not your browsing history, saved passwords, cookies, or visited-page records.

Sources

  1. DNS Cache Poisoning: Investigating Server and Client-Side Attacks and Mitigation Methods, doi.org,
  2. RFC 8499: DNS Terminology | RFC Editor, rfc-editor.org,
Share