- Technology
How to Flush DNS (Clear the Cache) in Windows and Mac
DNS (Domain Name System) cache stores information about previous DNS lookups on your computer. While this speeds up browsing, a corrupted or outdated cache can cause various issues. Flushing your DNS cache can resolve connection problems and ensure you’re accessing the most up-to-date versions of websites.
What is DNS Cache?
DNS cache is a temporary database maintained by your operating system that contains records of recent visits and attempted visits to websites. It stores:
- Domain names and their corresponding IP addresses
- Time-to-live (TTL) values for each record
- Previous lookup results to speed up subsequent requests
When Should You Flush DNS?
Consider flushing your DNS cache when you experience:
- Websites not loading or displaying errors
- 404 errors on sites you know exist
- Redirect issues after DNS changes
- Security concerns about DNS poisoning
- Unable to access newly launched websites
- After changing DNS servers
How to Flush DNS on Windows
For Windows 10 and Windows 11
-
Open Command Prompt as Administrator
- Press
Windows Key + X - Select “Command Prompt (Admin)” or “Windows PowerShell (Admin)”
- Or search for “cmd” in Start Menu, right-click, and select “Run as administrator”
- Press
-
Type the following command:
ipconfig /flushdns
-
Press Enter
-
You should see the message: “Successfully flushed the DNS Resolver Cache”
Additional Useful Commands for Windows
Display DNS cache before flushing:
ipconfig /displaydns
Register DNS:
ipconfig /registerdns
Release and renew IP address:
ipconfig /release
ipconfig /renew
How to Flush DNS on Mac
The command varies depending on your macOS version:
For macOS Ventura, Monterey, Big Sur, Catalina, Mojave, High Sierra, Sierra
-
Open Terminal
- Press
Command + Spaceto open Spotlight - Type “Terminal” and press Enter
- Or find it in Applications > Utilities > Terminal
- Press
-
Type the following command:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
-
Press Enter
-
Enter your administrator password when prompted
For Older macOS Versions
macOS El Capitan and Yosemite:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS Mountain Lion and Lion:
sudo killall -HUP mDNSResponder
macOS Leopard:
sudo lookupd -flushcache
Troubleshooting Tips
If problems persist after flushing DNS:
1. Restart Your Browser
Close all browser windows completely and reopen. Browsers maintain their own cache that may need clearing.
2. Clear Browser Cache
In addition to DNS cache, clear your browser’s cache and cookies.
3. Restart Your Computer
A full restart ensures all caches are cleared and services are refreshed.
4. Reset Network Settings
Windows:
netsh winsock reset
netsh int ip reset
Mac: Go to System Preferences > Network > Advanced > TCP/IP > Renew DHCP Lease
5. Change DNS Servers
Consider using public DNS servers like:
- Google DNS: 8.8.8.8 and 8.8.4.4
- Cloudflare DNS: 1.1.1.1 and 1.0.0.1
- OpenDNS: 208.67.222.222 and 208.67.220.220
Benefits of Regularly Flushing DNS
- Improved Security: Removes potentially malicious cached entries
- Better Performance: Ensures you get the fastest DNS resolution
- Updated Information: Accesses current IP addresses for websites
- Troubleshooting: First step in diagnosing connectivity issues
- Privacy: Clears browsing history stored in DNS cache
Best Practices
- Flush DNS after changing network settings
- Clear cache if experiencing persistent connection issues
- Consider flushing periodically for security purposes
- Document any recurring issues to identify patterns
- Test connectivity after flushing to confirm resolution
Conclusion
Flushing your DNS cache is a simple yet effective troubleshooting step that can resolve many common browsing issues. Whether you’re on Windows or Mac, the process takes just seconds and can save hours of frustration. Keep this guide handy for whenever you encounter DNS-related problems.
Remember: while flushing DNS is generally safe and beneficial, if you continue experiencing issues after following these steps, the problem may lie elsewhere in your network configuration or with your ISP.