
- 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.
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.
How to Clear DNS Cache on macOS
How to Clear DNS Cache on Linux
The method varies depending on your distribution and the DNS service in use.
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:
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
- Press Win + R to open the Run dialog.
- Type cmd, then right-click Command Prompt → Run as Administrator.
- Enter this command:
ipconfig /flushdns
- Press Enter.
You’ll see a confirmation message saying the DNS Resolver Cache was successfully flushed.
Method 2: Using PowerShell
- Open Start Menu → search for Windows PowerShell.
- Right-click and choose Run as Administrator.
- Type the following command and press Enter:
Clear-DnsClientCache
- DNS cache will now be cleared.
Works on Windows 8, 10, and 11.
How to Clear DNS Cache on macOS
- Open Applications → Utilities → Terminal.
- Enter the command:
sudo killall -HUP mDNSResponder
- Type your admin password when prompted.
- 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
Last edited: