How to Flush DNS Caches on Your System and Browser

How to Flush DNS Caches on Your System and Browser

When you change DNS records—or when propagation is still in progress—your computer or browser may keep showing you old results because of local DNS caching. Clearing those caches forces your device to fetch fresh records from the resolver.

Here’s a complete guide for flushing DNS caches across major operating systems and browsers.

1. Windows

Windows 10 / 11

  1. Open the Start Menu → type cmd.
  2. Right-click Command Prompt → select Run as Administrator.
  3. Run the following command:
ipconfig /flushdns

You should see the message:
Successfully flushed the DNS Resolver Cache.

Verify with:

nslookup www.dropletdrift.com

2. macOS

macOS Ventura (13) / Monterey (12) / Big Sur (11)

Open Terminal and run:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

No output means it succeeded.

Older macOS (Yosemite–Catalina)

sudo killall -HUP mDNSResponder

Verify with:

dig www.dropletdrift.com

3. Linux

Because Linux distributions differ, commands vary:

  • Ubuntu / Debian (systemd-resolved)
sudo systemd-resolve --flush-caches
  • systemd-resolvectl variant
sudo resolvectl flush-caches
  • nscd (Name Service Cache Daemon)
sudo service nscd restart
  • dnsmasq
sudo systemctl restart dnsmasq

Verify with:

systemd-resolve --statistics

Look for Cache hits and Cache misses resetting after a flush.

4. Browsers

Even if the OS cache is cleared, browsers often maintain their own DNS caches.

Google Chrome / Chromium / Edge

  1. Enter chrome://net-internals/#dns in the address bar.
  2. Click Clear host cache.

Firefox

  1. Type about:networking#dns in the address bar.
  2. Click Clear DNS Cache.

5. Local Resolver Services

If you run a local caching resolver (e.g. Unbound, BIND, dnsmasq), restart the service to clear its cache:

sudo systemctl restart unbound

or

sudo rndc flush

(for BIND).

Multi-Resolver DNS Flush & Verify — Scripts for Windows/Linux/macOS

When you change DNS, the fastest way to sanity-check what the world sees is to query multiple independent public resolvers after clearing your local caches. The scripts below do two things in one pass: (1) flush your local DNS cache where applicable, and (2) query several resolvers (Google 8.8.8.8, Cloudflare 1.1.1.1, Quad9 9.9.9.9, and OpenDNS 208.67.222.222). You’ll see each resolver’s current answer and TTL so you can spot which caches have refreshed and which haven’t. Use these during cutovers or when troubleshooting “propagation” delays.

Windows (Batch) — flushdns-multi.bat

@echo off
setlocal ENABLEDELAYEDEXPANSION

REM Usage: flushdns-multi.bat [FQDN] [QTYPE]
REM Defaults: FQDN=www.dropletdrift.com, QTYPE=A

set FQDN=%1
if "%FQDN%"=="" set FQDN=www.dropletdrift.com

set QTYPE=%2
if "%QTYPE%"=="" set QTYPE=A

set RESOLVERS=8.8.8.8 1.1.1.1 9.9.9.9 208.67.222.222

echo.
echo [*] Flushing Windows DNS resolver cache...
ipconfig /flushdns
echo.

echo [*] Querying %FQDN% (%QTYPE%) across multiple resolvers:
for %%R in (%RESOLVERS%) do (
  echo ------------------------------------------------------------
  echo Resolver: %%R
  REM nslookup doesn't show TTL; use PowerShell's Resolve-DnsName when available
  for /f "tokens=*" %%A in ('powershell -NoProfile -Command "if (Get-Command Resolve-DnsName -ErrorAction SilentlyContinue) { Resolve-DnsName %FQDN% -Type %QTYPE% -Server %%R | Format-Table -Auto Name,Type,IPAddress,NameHost,TTL } else { Write-Output \"(Tip) Run in PowerShell for TTL, or install dig. Falling back to nslookup...\"; }"') do echo %%A
  nslookup -type=%QTYPE% %FQDN% %%R
)

echo ------------------------------------------------------------
echo Done.
pause
endlocal

macOS / Linux (Bash) — flushdns-multi.sh

#!/usr/bin/env bash
# Usage: ./flushdns-multi.sh [FQDN] [QTYPE]
# Defaults: FQDN=www.dropletdrift.com, QTYPE=A

set -euo pipefail

FQDN="${1:-www.dropletdrift.com}"
QTYPE="${2:-A}"
RESOLVERS=(8.8.8.8 1.1.1.1 9.9.9.9 208.67.222.222)

echo
echo "[*] Flushing local DNS caches where applicable..."

if [[ "$OSTYPE" == "darwin"* ]]; then
  # macOS
  sudo dscacheutil -flushcache || true
  sudo killall -HUP mDNSResponder || true
else
  # Linux variants
  if command -v systemd-resolve >/dev/null 2>&1; then
    sudo systemd-resolve --flush-caches || true
  elif command -v resolvectl >/dev/null 2>&1; then
    sudo resolvectl flush-caches || true
  fi

  if command -v service >/dev/null 2>&1 && service nscd status >/dev/null 2>&1; then
    sudo service nscd restart || true
  fi

  if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files | grep -q '^dnsmasq\.service'; then
    sudo systemctl restart dnsmasq || true
  fi

  if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files | grep -q '^unbound\.service'; then
    sudo systemctl restart unbound || true
  fi
fi

echo
echo "[*] Querying $FQDN ($QTYPE) across multiple resolvers..."
for R in "${RESOLVERS[@]}"; do
  echo "------------------------------------------------------------"
  echo "Resolver: $R"
  # Show authoritative-style answer lines with TTLs (no headers)
  dig @"$R" "$FQDN" "$QTYPE" +noall +answer +ttlid
done

echo "------------------------------------------------------------"
echo "Done."

Quick usage notes

# Windows
# 1) Right-click the .bat file → Run as Administrator
# 2) Optional: pass FQDN and type
flushdns-multi.bat www.dropletdrift.com A

# macOS / Linux
chmod +x flushdns-multi.sh
./flushdns-multi.sh www.dropletdrift.com A

Interpretation tips:

  • If one resolver shows the new answer with a low TTL while another still shows the old answer with a high TTL, you’re watching cache expiry in real time.
  • If all resolvers agree but your browser doesn’t, clear the browser DNS cache and try again.
  • Swap A for AAAA, CNAME, MX, etc., as needed during cutovers.

Was this helpful?

Thanks for your feedback!

Leave a comment

Your email address will not be published. Required fields are marked *