blog

How to Flush DNS Cache: Windows ipconfig vs macOS dscacheutil for Refreshing DNS

Flush the local DNS cache first when a website points to the wrong server, loads an old IP address, or fails right after a DNS change. On Windows, use ipconfig /flushdns; on macOS, use sudo dscacheutil -flushcache and usually restart mDNSResponder as well. Microsoft documents ipconfig /flushdns as the command that purges the DNS resolver cache [source: Microsoft].

TLDR: If Windows is showing an old website location, open Command Prompt and run ipconfig /flushdns. If macOS is doing the same, run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. For example, after moving a company site from 203.0.113.10 to 198.51.100.25, 15 out of 40 staff machines may still hit the old server until local DNS cache is cleared. This fix usually takes under one minute, but it does not clear DNS caches held by routers, ISPs, or browsers.

What DNS cache flushing actually does

DNS turns a domain name, such as example.com, into an IP address. Your operating system stores recent answers for a limited time. That storage is the DNS cache.

That cache is useful. It avoids repeated lookups. Pages feel faster. Apps connect with less delay. The problem starts when the cached answer is stale, poisoned, or simply not what you want anymore.

Common signs include:

  • A website still opens the old hosting server after migration.
  • A domain works on mobile data but not on office Wi Fi.
  • Email, VPN, or SSO endpoints fail after a DNS record change.
  • You get certificate warnings because the browser reaches the wrong server.
  • Only one computer has the problem while others work fine.

Honestly, it feels like a tiny command should not fix so many issues. But DNS cache problems are common because every layer tries to save time by remembering old answers.

Windows: using ipconfig /flushdns

On Windows 10, Windows 11, and many Windows Server versions, the standard command is simple:

ipconfig /flushdns

Use these steps:

  1. Press Windows, type cmd, and open Command Prompt.
  2. Type ipconfig /flushdns.
  3. Press Enter.
  4. Look for: Successfully flushed the DNS Resolver Cache.

You can also run it in PowerShell:

ipconfig /flushdns

Administrator rights are not always required for this command, but using an elevated terminal removes doubt. If you are helping a user remotely, ask them to read the success message back to you. It saves another five minutes of guessing.

Check the Windows DNS cache before or after flushing

To view cached entries, run:

ipconfig /displaydns

Expect a lot of output. Windows stores records for apps, browsers, background services, and system processes. It drives me crazy that a single test page can leave several entries behind, but that is normal behavior.

After flushing, run:

nslookup example.com

Replace example.com with your real domain. Confirm that the returned IP address matches the DNS record you expect.

macOS: using dscacheutil and mDNSResponder

On current macOS releases, the practical command is usually:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Use these steps:

  1. Open Terminal.
  2. Paste the command above.
  3. Press Return.
  4. Enter your Mac password when prompted.

The password will not appear as you type. That is normal. Press Return after typing it.

The dscacheutil -flushcache part clears cached directory and lookup data. The killall -HUP mDNSResponder part tells the macOS DNS responder process to reload. Apple has changed DNS cache behavior across versions, so technicians often run both commands to avoid wasting time [source: Apple].

Older macOS versions

Most users on recent macOS versions can use the command above. Older systems may need version-specific commands. For example, some older releases used discoveryutil, while others used different mDNSResponder signals.

If you manage mixed Mac fleets, document the command by macOS version. Do not depend on memory. It is an easy way to lose 20 minutes during an outage.

Windows vs macOS: the key differences

Area Windows macOS
Main command ipconfig /flushdns sudo dscacheutil -flushcache
Often paired with Nothing else sudo killall -HUP mDNSResponder
Credential prompt Usually no prompt Admin password required
Success message Clear success text Often no output
Best follow up test nslookup domain.com dig domain.com or nslookup domain.com

The Windows process feels cleaner because it gives a clear success message. macOS often returns silently. No news can be good news, but it is not friendly when you are troubleshooting under pressure.

When flushing DNS will not fix the problem

Flushing local DNS is safe and fast, but it is not magic. If the problem sits elsewhere, you need more checks.

  • Browser DNS cache: Chrome, Edge, and Firefox may keep their own DNS or connection state.
  • Router cache: Some home and office routers cache DNS answers.
  • ISP resolver cache: Your provider may still have an older answer.
  • Low quality DNS setup: Wrong A, AAAA, CNAME, MX, or NS records will stay wrong.
  • TTL delay: DNS records can remain valid until their time to live expires.
  • VPN DNS rules: Split tunnel settings may send queries to unexpected resolvers.

For browser-specific issues, restart the browser after flushing the operating system cache. In stubborn cases, close the browser fully, reopen it, and test in a private window. Also clear socket pools if your browser provides that option.

A practical troubleshooting order

Use a strict order. Random checks waste time.

  1. Confirm the expected IP address in your DNS hosting panel.
  2. Query public resolvers, such as Google DNS or Cloudflare DNS, with nslookup or dig.
  3. Flush the local DNS cache on the affected machine.
  4. Restart the browser or app that still fails.
  5. Test on another network, such as mobile hotspot.
  6. Check VPN, proxy, and security software if only corporate devices fail.

On Windows, a useful test is:

nslookup example.com 8.8.8.8

On macOS, use:

dig example.com @1.1.1.1

These commands ask a specific public DNS resolver. If public DNS returns the new IP but your machine does not, the local system, router, VPN, or enterprise DNS service is likely the issue.

Security and reliability notes

Flushing DNS does not delete files, browser history, saved passwords, or cookies. It only removes cached name resolution data. It is a low-risk step for normal users and support teams.

Still, use the correct command. Do not copy random terminal chains from forums. A DNS flush command should be short, readable, and limited to cache clearing or restarting the DNS responder.

For managed devices, record the action in the support ticket. Include the domain tested, old IP, new IP, command used, and result. That creates a clean audit trail and helps the next technician avoid repeated work.

Best command to use

For Windows, use:

ipconfig /flushdns

For macOS, use:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Use these commands when DNS changes are complete but a device still behaves as if nothing changed. If the issue remains after flushing, test public resolvers, browser cache, router DNS, VPN rules, and the DNS records themselves. That is the fastest path from stale DNS to a working connection.