How to Clear DNS Cache on Windows, macOS & Linux

x32x01
  • by x32x01 ||
Over time, your computer stores DNS data to speed up website access. But sometimes, outdated or malicious DNS entries can cause slow connections, loading errors, or even security risks. Flushing the DNS cache removes this junk and keeps your internet performance smooth and safe.

What Is DNS Cache?​

The DNS (Domain Name System) cache is a temporary database your device uses to store website IP addresses. When you visit a website, the DNS cache remembers its address to make future visits faster.

However, if a website’s IP changes or becomes compromised, your computer may fail to connect properly. That’s when clearing the DNS cache helps - it resets saved entries and forces your device to fetch fresh data.



How to Clear DNS Cache on Windows 💻​

There are two easy ways to flush DNS on Windows: using Command Prompt or PowerShell.

Method 1: Using Command Prompt​

  1. Press Win + R to open the Run dialog.
  2. Type cmd, then right-click Command PromptRun as Administrator.
  3. Enter this command: ipconfig /flushdns
  4. Press Enter.
    ✅ You’ll see a confirmation message saying the DNS Resolver Cache was successfully flushed.

Method 2: Using PowerShell​

  1. Open Start Menu → search for Windows PowerShell.
  2. Right-click and choose Run as Administrator.
  3. Type the following command and press Enter: Clear-DnsClientCache
  4. DNS cache will now be cleared.
    🪄 Works on Windows 8, 10, and 11.



How to Clear DNS Cache on macOS 🍏​

  1. Open Applications → Utilities → Terminal.
  2. Enter the command: sudo killall -HUP mDNSResponder
  3. Type your admin password when prompted.
  4. Press Enter again.
    🎉 Your DNS cache is now reset!



How to Clear DNS Cache on Linux 🐧​

The method varies depending on your distribution and the DNS service in use.

For nscd Service​

Code:
sudo /etc/init.d/nscd restart

For bind Service​

Code:
sudo /etc/init.d/named restart
sudo rndc restart

For dnsmasq Service​

Code:
sudo /etc/init.d/dnsmasq restart

Each of these commands restarts the DNS service, effectively flushing the stored DNS cache.



Final Thoughts ✨​

Clearing your DNS cache is a quick and safe maintenance task that can:
  • Improve browsing speed ⚡
  • Fix website loading errors 🌐
  • Protect your device from malicious entries 🛡️
Performing a DNS flush once in a while keeps your system clean and your internet experience smooth - no tech skills required!
How-To-Clean-DNS-Cache-in-Windows-Linux-and-macOS.jpg
 
Last edited:
Related Threads
x32x01
Replies
0
Views
324
x32x01
x32x01
x32x01
Replies
0
Views
1K
x32x01
x32x01
x32x01
Replies
0
Views
553
x32x01
x32x01
x32x01
Replies
0
Views
659
x32x01
x32x01
x32x01
Replies
0
Views
1K
x32x01
x32x01
TAGs: Tags
clear dns cache macos clear dnsclientcache powershell dns resolver cache reset flush dns linux flush dns windows ipconfig flushdns command mdnsresponder macos command network troubleshooting tips restart dnsmasq service restart nscd service
Register & Login Faster
Forgot your password?
Forum Statistics
Threads
727
Messages
732
Members
70
Latest Member
blak_hat
Back
Top