Flushing the DNS cache fixes many stale website and server lookups by forcing the operating system to ask DNS again instead of reusing an old answer. On Windows, the usual command is ipconfig /flushdns, which Microsoft lists as the option that clears the DNS resolver cache [source: Microsoft]. On macOS, the common modern approach is sudo dscacheutil -flushcache followed by sudo killall -HUP mDNSResponder. Both methods do the same basic job, but they fit different operating systems, shells, permissions, and troubleshooting habits.
TLDR: Windows uses ipconfig /flushdns in Command Prompt or PowerShell, while macOS usually needs dscacheutil plus a restart signal for mDNSResponder. A small office that moves an internal app from 10.0.1.25 to 10.0.1.80 may still see 5 to 15 percent of laptops hit the old address until the cache expires or gets cleared. Flushing DNS is quick, low risk, and often saves 10 to 30 minutes of pointless browser testing. The catch is that macOS gives almost no visible success message, which makes the process feel less clear than Windows.
Contents
What DNS Cache Flushing Actually Does
DNS turns names into IP addresses. A browser asks for example.com, and DNS returns an address such as 93.184.216.34. To avoid asking again every few seconds, the operating system stores that answer in a local cache.
That cache is useful. It speeds up repeat visits. It cuts network chatter. It also reduces load on DNS servers. Still, it can become annoying fast when a DNS record changes and the computer refuses to let go of the old answer.
A stale cache can cause several symptoms:
- A website opens on one device but fails on another.
- A domain points to an old server after migration.
- An internal hostname resolves to the wrong private IP address.
- VPN users reach outdated company resources.
- Browser tests keep failing even after DNS settings were fixed.
Flushing the cache removes the saved answers. After that, the system asks DNS again. If the public or internal DNS records are correct, the machine should receive the new answer.
Windows: Using ipconfig /flushdns
On Windows, the classic tool is ipconfig. It is built in, fast, and easy to remember. An administrator, support technician, or regular user can run the command from Command Prompt or PowerShell.
Windows steps
- Open Start.
- Search for Command Prompt or PowerShell.
- Run it normally, or choose Run as administrator if policy requires it.
- Type
ipconfig /flushdns. - Press Enter.
Windows usually replies with a clear message:
Successfully flushed the DNS Resolver Cache.
That message is useful. It removes the guesswork. Honestly, it feels like macOS could learn from that tiny bit of feedback.
Windows also provides related commands that help during DNS troubleshooting:
ipconfig /displaydnsshows cached DNS entries.nslookup example.comchecks how a name resolves.ipconfig /registerdnsrefreshes DNS registration for the local machine.
For many support teams, the Windows process is faster because the result is visible. A technician can flush the cache, rerun a lookup, and compare the answer in under a minute.
macOS: Using dscacheutil and mDNSResponder
macOS handles name resolution through several services. That includes DNS cache handling and local network name discovery. For current macOS versions, the most common command pair is:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
The first command clears cached directory service entries, including DNS-related cache data. The second sends a hangup signal to mDNSResponder, the service involved in DNS and multicast DNS resolution. The goal is to make macOS forget stale records and request fresh answers.
macOS steps
- Open Terminal.
- Run
sudo dscacheutil -flushcache. - Enter the administrator password when prompted.
- Run
sudo killall -HUP mDNSResponder. - Test the domain again with
dig,nslookup, or a browser.
macOS may return no success message. That silence is normal. It also drives people a little mad during support calls. A user may run the command correctly and still wonder whether anything happened.
For testing, support staff often use:
dig example.comfor detailed DNS query results.nslookup example.comfor a simple answer check.ping hostnamefor a quick hostname-to-IP check, though ping can be blocked.
Windows vs macOS: Main Differences
| Area | Windows | macOS |
|---|---|---|
| Main command | ipconfig /flushdns |
sudo dscacheutil -flushcache |
| Extra command often used | Usually none | sudo killall -HUP mDNSResponder |
| Feedback | Clear success message | Often no message |
| Permission needs | Often works in a normal shell | Usually needs sudo |
| Best fit | Fast help desk fixes | Mac troubleshooting after DNS or VPN changes |
The Windows command is simpler. The macOS method gives less feedback and often needs two commands. Still, both are effective when the local DNS cache is the problem.
When Flushing DNS Helps
DNS flushing is useful after a record change, hosting move, CDN update, VPN change, or internal server replacement. It also helps after editing a hosts file, switching DNS servers, or moving between office and home networks.
Common timing issues come from TTL, or time to live. A DNS record may have a TTL of 300 seconds, 3,600 seconds, or more. If a domain is moved but the old record had a one-hour TTL, some machines may keep the old answer until that time ends. Flushing cuts that wait on the local machine.
Still, flushing DNS is not magic. It does not fix wrong authoritative DNS records. It does not repair a broken web server. It does not clear every browser-level cache. Chrome, Edge, Firefox, and Safari may keep their own socket or connection state for a short time.
Quick Testing After a Flush
After clearing DNS, the user or technician should test the result. A clean test avoids wasted time.
- Check DNS directly:
nslookup domain.comordig domain.com. - Compare expected IPs: confirm that the new address appears.
- Restart the browser: this clears some stubborn connection state.
- Try another network: mobile hotspot testing can expose ISP or router caching.
- Flush router DNS if needed: some routers cache DNS too.
If the same old IP returns after a flush, the issue may sit upstream. The DNS server being queried may still have the old response. In that case, changing to another resolver for testing, such as a company DNS server or a public resolver, can help isolate the cause.
Best Practice for DNS Changes
Before a planned migration, administrators should lower TTL values early. A common pattern is to reduce TTL from 3,600 seconds to 300 seconds at least a day before the cutover. That gives caches time to age out before the real change happens.
After the migration, support teams can flush DNS on key machines. They can also restart browsers and VPN clients. For business-critical tools, a short checklist works better than random retries.
- Lower TTL before the change.
- Update the DNS record.
- Flush local DNS caches.
- Restart browsers or apps.
- Verify the new IP with command-line tools.
- Raise TTL again after the change is stable.
FAQ
- Does flushing DNS delete internet history?
- No. It only clears stored DNS lookup results. Browser history, cookies, saved passwords, and bookmarks remain untouched.
- Is
ipconfig /flushdnssafe? - Yes. It is a routine troubleshooting command. The system simply requests fresh DNS answers the next time a domain is used.
- Why does macOS need
sudo? - The cache and resolver services are system-level components. macOS asks for administrator rights before changing or signaling them.
- Why is there no success message on macOS?
- Many macOS terminal commands stay quiet when they work. If no error appears, the command usually completed.
- Should a browser be restarted after flushing DNS?
- Often, yes. Some browsers keep open connections or their own temporary DNS state. A restart makes testing cleaner.
- What if the old IP still appears?
- The DNS server may still have the old record, or the authoritative record may be wrong. The next step is to test with
digornslookupagainst a known DNS resolver.
