Guides

Step-by-step practical fixes for everyday technical problems.
Network Guides

How to Flush DNS Cache

Clear local DNS cache so your system stops using stale records and requests fresh DNS information again.

Before you start

Flush DNS when the system still points a domain to an old IP after a recent DNS change.
This only clears local cache. It does not force the upstream DNS server to refresh instantly.
If possible, run a lookup command before and after the flush so you can compare the result clearly.

When flushing DNS is the right move

A domain was moved to a new server

Your machine may still be using an older cached IP even though the DNS record has already been updated.

A website opens the wrong location

Old DNS cache can send you to the previous server or environment instead of the new one.

You changed CDN, reverse proxy, or SSL setup

Local cached records may still point to an older network path even after infrastructure changes are complete.

You already know the DNS change should have taken effect

If the authoritative records are correct but your own machine still behaves differently, local DNS cache is a likely suspect.

Step-by-step instructions

1. Check the current DNS result first

Before flushing anything, check what IP address your system currently resolves for the domain. This gives you something concrete to compare after the cache is cleared.

Command
nslookup example.com
Why this matters

If the result changes after flushing, you know the old value really was coming from cache or local resolver behavior.

2. Flush DNS on Windows

On Windows, use the built-in command below from Command Prompt. Running it as Administrator is often the cleanest approach.

Windows
ipconfig /flushdns
Expected output

Windows should report that the DNS Resolver Cache was flushed successfully.

3. Flush DNS on macOS

On macOS, the usual command is run through Terminal with sudo.

macOS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Practical note

macOS versions vary, but this command works in many common modern cases and is a solid first troubleshooting step.

4. Flush DNS on Linux

On Linux, the exact command depends on the resolver service being used. A very common modern setup uses systemd-resolved.

Linux
sudo resolvectl flush-caches
Important

If your Linux system is using another resolver such as nscd or dnsmasq, the correct restart or flush method may be different.

5. Run the DNS lookup again after flushing

After the flush, run the same lookup again and compare the result with the value you saw before.

Command
nslookup example.com
What to look for

If the IP or DNS answer changed to the expected new value, the flush probably resolved the issue.

6. Continue troubleshooting if nothing changes

If the lookup result stays the same, the problem may not be local cache at all. The upstream DNS server, propagation state, or another caching layer may still be the real cause.

Next checks

At that point, compare results with another DNS server, use nslookup or dig directly, and confirm whether the DNS record has really propagated as expected.

Common mistakes

Flushing cache without checking the current DNS result first

Without a before-and-after comparison, it is harder to tell whether flushing DNS actually changed anything.

Assuming local cache is always the problem

If the DNS server itself still returns old data, flushing your local cache will not magically fix the upstream record.

Using the wrong Linux command for the actual resolver

Linux DNS behavior depends on which resolver service is active, so the correct flush method may differ across systems.

Stopping after the flush without verifying the result

The correct workflow is flush first, then test again immediately so you know whether the DNS answer really changed.

About this guide

This guide shows how to flush DNS cache when a computer keeps using an old IP address, opens the wrong site, or fails to pick up recent DNS changes. It focuses on practical commands for Windows, macOS, and Linux, plus the checks you should do before and after clearing the cache.

How to follow this guide

  1. Confirm the issue looks like a DNS cache problem before clearing anything.
  2. Run the correct flush command for Windows, macOS, or Linux.
  3. Repeat the DNS lookup after flushing the cache.
  4. Compare the new result with the expected IP or hostname.
  5. If nothing changes, continue with resolver, DNS server, or propagation checks.

Why use this method?

DNS cache problems are common after domain moves, DNS record updates, server migrations, CDN changes, or SSL setup work. Flushing the local cache is often the fastest way to force the system to ask for fresh DNS information instead of reusing an old record.

Frequently Asked Questions

When should I flush DNS cache?

Flush DNS cache when your computer still resolves a domain to an old IP address or continues showing outdated DNS behavior after a recent change.

Does flushing DNS change my DNS server?

No. It only clears the cached local records so the system requests fresh DNS data again.

Why does the problem remain after flushing DNS?

The DNS server itself may still have old data, propagation may still be in progress, or another cache layer may still be involved.

Is flushing DNS safe?

Yes. It is a normal troubleshooting step and only clears temporary cached DNS records.