How to Flush DNS Cache on Any System

  • Author: Dharmil Shiroya
  • Published: 2 July 2025
  • Last Updated: 3 July 2025
How to Flush DNS Cache on Any System

Table Of Contents

Flush DNS Cache might sound like a techy chore, but it’s one of the simplest tricks to keep your internet connection fresh and responsive. Think of DNS cache as a notebook your computer keeps, jotting down internet addresses so it doesn’t have to look them up every time. But what happens when the notes get outdated or messy? That’s when flushing your DNS comes in handy. Whether you’re facing connectivity hiccups or just updated a domain and need your computer to recognize it, this full guide will walk you through every step across all devices and operating systems.

What is DNS Cache?

DNS cache, short for Domain Name System cache, is like your browser’s short-term memory for websites. Every time you type a web address let’s say  www.example.com. Your computer queries a DNS server to find the corresponding IP address. To save time on future visits, your device stores this mapping locally. That little stash of address info is your DNS cache.

This stored data is meant to speed things up. Instead of repeating the entire lookup process every time you visit a site, your system simply refers to the saved DNS entry. It’s like using speed dial instead of dialing the number manually. Pretty smart, right?

But as efficient as it sounds, DNS cache can get outdated or corrupted. If the site changes servers or the DNS record is updated, your computer might still try to use the old address, leading to broken pages or “Site Not Found” errors.

Flush DNS Cache

Why is DNS Cache Important?

Imagine having to call a friend and needing to look up their number in the phonebook every single time. Tedious, isn’t it? That’s essentially the internet without DNS caching. By storing resolved IP addresses locally, DNS cache significantly cuts down the time it takes to reach websites, improving browsing speed and reducing network traffic.

But speed isn’t the only benefit. DNS caching also reduces the load on DNS servers, which can improve the performance of the entire network infrastructure. It’s like fewer people calling customer support because they found the answer in a FAQ section.

However, that importance comes with a warning cache memory isn’t forever accurate. If things change on the server-side, your cache might still be stuck in the past, leading to problems accessing websites. Hence, while it’s important, it also needs occasional refreshing.

Common Issues Caused by a Corrupted DNS Cache

Now let’s talk about the dark side. When DNS cache works, it’s great. But when it goes rogue, corrupted or outdated. It can cause quite a few headaches:

  • Inaccessible websites: The most common sign of a bad DNS cache is when known websites suddenly stop loading.
  • Redirects to incorrect sites: Malicious cache poisoning can redirect you to phishing sites.
  • Connection timeouts: You might see delays or timeouts as your browser tries to resolve addresses that no longer exist.
  • Inconsistent browsing experience: Some pages might load while others don’t, depending on whether the cache is still valid for that domain.

So if your internet is misbehaving and you’ve ruled out router issues or a faulty connection, flushing your DNS cache could be the solution that sets everything straight again.

Reasons to Flush Your DNS Cache

Privacy Protection

You may not realize it, but your DNS cache is like a digital trail of where you’ve been online. Every website you visit gets logged with its IP address and a time-to-live (TTL) setting. This data sits on your system and can potentially be accessed by malicious actors or invasive software.

Flushing the DNS cache wipes that trail clean. It’s especially useful if you’re using a shared or public computer, where you don’t want the next user snooping around your digital footsteps. Think of it as clearing your browsing history but for the whole system, not just your browser.

Also, for privacy-conscious users who use VPNs or switch between different networks, flushing DNS helps ensure your queries don’t get linked or leaked through cached entries from previous sessions.

Solving Connectivity Issues

If you’ve ever clicked on a link and seen a “server not found” error despite knowing the site exists, your DNS cache might be to blame. When websites change their server locations or update their DNS records, your computer might still cling to the outdated data.

Flushing the DNS cache clears out the old entries and forces your system to fetch the updated records. This is a super helpful fix for:

  • Sites that refuse to load for no apparent reason.
  • Errors that only occur on one device or browser.
  • Inconsistent access like when a site works on mobile data but not on Wi-Fi.

A quick flush can often solve these weird glitches instantly.

Updating DNS Records After Changes

Let’s say you just changed the DNS settings for your domain maybe you switched web hosts or added a new subdomain. You try to view the changes, but your computer keeps pulling up the old version. That’s the cache again.

Flushing DNS cache ensures your system fetches the latest DNS records, reflecting those updates immediately. This is essential for web developers, network administrators, and even business owners managing their online presence.

It’s not just limited to personal machines either. Network routers, internal company DNS resolvers, and even cloud-based load balancers may benefit from a DNS cache flush after any major changes.

When to Flush DNS Cache

Understanding when to flush your DNS cache can help you troubleshoot network issues more effectively:

  • Website Loading Issues: When specific websites won’t load or display outdated content
  • DNS Resolution Errors: Receiving “DNS server not responding” or similar error messages
  • Network Configuration Changes: After changing DNS servers or network settings
  • Development Work: When testing website changes or working with local development environments
  • Security Concerns: After potential DNS poisoning or malware infections
  • Regular Maintenance: As part of routine system maintenance and troubleshooting

How to Flush DNS Cache on Different Operating Systems

Windows 10/11

Windows stores DNS cache to improve browsing performance, but clearing it can resolve various network connectivity issues. Here are two methods to flush DNS cache on Windows systems.

Using Command Prompt

The Command Prompt method is the most straightforward approach for Windows users and works across all versions of Windows 10 and 11

Step 1: Open Command Prompt as Administrator

  • Press Windows + R to open the Run dialog box
  • Type cmd and press Ctrl + Shift + Enter to run as administrator
  • Alternatively, right-click the Start button and select “Command Prompt (Admin)” or “Windows PowerShell (Admin)”
  • Click “Yes” when prompted by User Account Control

Step 2: Execute the DNS Flush Command

  • In the command prompt window, type the following command:
ipconfig /flushdns
  • Press Enter to execute the command

Step 3: Verify the Process

  • You should see a confirmation message: “Successfully flushed the DNS Resolver Cache”
  • Close the Command Prompt window

Additional Helpful Commands:

  • To view current DNS cache before flushing: 
ipconfig /displaydns
  • To release current IP configuration: 
ipconfig /release
  • To renew IP configuration: 
ipconfig /renew

Using PowerShell

PowerShell offers a more modern approach with additional DNS management capabilities.

Step 1: Open PowerShell as Administrator

  • Right-click the Start button and select “Windows PowerShell (Admin)”
  • Or press Windows + X and choose “Windows PowerShell (Admin)”
  • Click “Yes” when prompted by User Account Control


Step 2: Execute the DNS Clear Command

  • Type the following command in PowerShell:
Clear-DnsClientCache
  • Press Enter to execute

Step 3: Verify DNS Cache is Cleared

  • To confirm the cache is empty, run:
Get-DnsClientCache
  • An empty result indicates successful cache clearing

Additional PowerShell DNS Commands:

View DNS cache: 

Get-DnsClientCache

Clear specific DNS records: 

Clear-DnsClientCache -Name "example.com"

Set DNS server: 

Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ServerAddresses "8.8.8.8","8.8.4.4"

macOS (Catalina, Big Sur, Monterey, Ventura, Sonoma)
macOS handles DNS caching differently across versions, but the Terminal method remains consistent and effective for all recent versions.

Using Terminal Commands

The process varies slightly depending on your macOS version, but the core approach remains the same.

Step 1: Open Terminal

  • Press Command + Space to open Spotlight Search
  • Type “Terminal” and press Enter
  • Alternatively, go to Applications > Utilities > Terminal

Step 2: Execute the Appropriate Command

For macOS Monterey (12.0+), Ventura (13.0+), and Sonoma (14.0+):

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

For macOS Big Sur (11.0+) and Catalina (10.15+):

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

For older macOS versions (10.10-10.14):

sudo killall -HUP mDNSResponder

Step 3: Enter Administrator Password

  • Type your Mac administrator password when prompted
  • Note: The password won’t be visible as you type for security reasons
  • Press Enter after entering the password

Step 4: Verify the Process

  • The command will execute silently without confirmation message
  • Wait a few seconds for the process to complete
  • You can verify by attempting to access previously problematic websites

Additional macOS DNS Management:

  • To view current DNS settings: 
scutil --dns
  • To check DNS resolution for a specific domain: 
nslookup example.com
  • To trace DNS resolution path: 
dig example.com

Linux (Ubuntu, Debian, Fedora)

Linux distributions handle DNS caching through various services. The method depends on your system’s DNS resolver configuration.

Flushing via systemd-resolve

Most modern Linux distributions use systemd-resolved for DNS management.

Step 1: Check if systemd-resolved is Running

systemctl status systemd-resolved

Step 2: Flush DNS Cache Using systemd-resolve

sudo systemd-resolve --flush-caches

Step 3: Verify Cache Statistics

  • Check cache statistics before flushing:
systemd-resolve --statistics
  • After flushing, run the same command to verify cache is cleared

Step 4: Restart systemd-resolved (if needed)

sudo systemctl restart systemd-resolved

Alternative systemd-resolve Commands:

  • View DNS settings: systemd-resolve –status
  • Query specific domain: systemd-resolve example.com
  • Reset all resolver settings: sudo systemctl restart systemd-resolved

Flushing via nscd or dnsmasq

Some Linux systems use nscd (Name Service Cache Daemon) or dnsmasq for DNS caching.

For nscd (Name Service Cache Daemon):

Step 1: Check if nscd is Running

systemctl status nscd

Step 2: Flush nscd Cache

sudo systemctl restart nscd

Alternative nscd flush command:

sudo nscd -i hosts

For dnsmasq:

Step 1: Check if dnsmasq is Running

systemctl status dnsmasq

Step 2: Flush dnsmasq Cache

sudo systemctl restart dnsmasq

Alternative method to clear dnsmasq cache:

sudo killall -USR1 dnsmasq

For NetworkManager (Common on Desktop Linux):

Step 1: Restart NetworkManager

sudo systemctl restart NetworkManager

Step 2: Alternatively, Reset Network Connection

sudo nmcli networking off
sudo nmcli networking on

Distribution-Specific Notes:

Ubuntu/Debian:

  • Default DNS resolver varies by version
  • Ubuntu 18.04+ typically uses systemd-resolved
  • Check with: 
sudo lsof -i :53

Fedora/CentOS/RHEL:

  • Usually uses systemd-resolved in recent versions
  • May use NetworkManager for DNS management
  • Check active DNS service:
 sudo ss -tulpn | grep :53

Additional Linux DNS Troubleshooting:

  • View current DNS configuration: 
cat /etc/resolv.conf
  • Test DNS resolution: 
dig example.com or nslookup example.com
  • Check which process is handling DNS: 
sudo netstat -tulpn | grep :53

Flushing DNS Cache in Popular Browsers

Sometimes, the problem isn’t with your OS. It’s your browser clinging to DNS info longer than it should. Here’s how to flush DNS cache specifically within your web browser:

Google Chrome

Chrome has its own internal DNS cache, separate from your operating system’s cache.

To clear it:

  1. Open Chrome.
  2. In the address bar, type:
  3. chrome://net-internals/#dns
  4. Press Enter.
  5. Click on the “Clear host cache” button.

You won’t get a confirmation, but trust that it’s cleared. This is super useful if a website isn’t resolving properly only in Chrome.

Mozilla Firefox

Firefox also keeps a temporary DNS cache. Here’s how to flush it:

  1. Type in the address bar.
about:networking#dns
  1. Press Enter.
  2. Click the “Clear DNS Cache” button.

Firefox also allows you to disable its DNS cache entirely, but that’s only recommended for troubleshooting.

Microsoft Edge

Since Edge is built on Chromium, it shares many of Chrome’s features.

To flush DNS:

  1. Type in:
edge://net-internals/#dns
  1. Press Enter.
  2. Click “Clear host cache.”

Doing this can help when websites won’t load correctly in Edge while working fine elsewhere.

Automating DNS Cache Flushing

If you often find yourself flushing DNS manually, automating the task can save time and ensure smooth browsing without manual intervention.

Setting Up Scheduled Tasks on Windows

You can schedule DNS flushing on a regular basis using Windows Task Scheduler:

  1. Open Task Scheduler from the Start menu.
  2. Click “Create Basic Task.”
  3. Name it something like “DNS Flush Task”.
  4. Choose how often you want it to run (daily or weekly is common).
  5. In the “Action” section, select “Start a Program.”
  6. In the Program/script box, type:
  7. ipconfig
  8. In the Add arguments field, enter:
  9. /flushdns

Finish the setup, and you’re done. Your DNS cache will now be flushed automatically at the interval you specified.

Using Cron Jobs on Linux/macOS

On Unix-like systems, a cron job can do the trick:

  1. Open the terminal.
  2. Type:
  3. crontab -e

Add a line like this (to flush every day at midnight):

0 0 * * * sudo systemd-resolve --flush-caches

Make sure your user has the right permissions, or use sudo crontab -e to create a root-level task.

This is a powerful method for sysadmins managing servers, ensuring they always resolve fresh DNS without manual work.

How Often Should You Flush Your DNS Cache?

Best Practices for Routine Flushing

There’s no hard rule for how often you should flush your DNS cache, it really depends on how you use the internet. For the average user, doing it every couple of weeks is enough to keep things running smoothly. However, if you’re someone who tinkers with DNS settings, hosts websites, or uses a VPN, you might want to do it more frequently.

Flushing too often can slightly slow down your initial connections to websites since your device has to rebuild the cache. But that’s a tiny price to pay for the added benefits of accuracy and security.

Here are a few guidelines to consider:

  • Flush bi-weekly if you’re a casual user.
  • Flush weekly if you use a VPN regularly.
  • Flush after any DNS or domain configuration change.
  • Flush immediately if you encounter connectivity issues.

Make it part of your digital hygiene routine—just like clearing browser cache or running a malware scan.

Situational Flushing Tips

Some scenarios demand an immediate flush:

  • After switching DNS providers like moving from Google DNS to Cloudflare.
  • Post malware cleanup, since malicious programs can manipulate your DNS cache.
  • Following a network error where a specific website won’t load.
  • When using multiple networks, like moving between work, home, or public Wi-Fi.

Also, if you’ve changed your domain’s nameservers or switched to a new web host, flushing DNS will prevent you from seeing outdated or broken versions of your site.

A little awareness goes a long way. Know when your DNS cache needs a clean-up, and your internet experience will be noticeably smoother.

Security Implications of DNS Caching

DNS Spoofing and Poisoning

Here’s where things get a bit scary. DNS cache isn’t just about speed; it’s also a potential vulnerability. If a bad actor manages to “poison” your DNS cache, they can redirect you to malicious sites without you even knowing.

DNS spoofing (or cache poisoning) happens when a fake DNS entry is inserted into your cache, sending you to a fraudulent website that looks real but is designed to steal your data.

This can happen due to:

  • Weak DNS servers.
  • Malware infections.
  • Public Wi-Fi vulnerabilities.

Once poisoned, your cache keeps redirecting you to the wrong site until you flush it.

Protecting Your Network

To safeguard against DNS-based attacks, consider these tips:

  • Flush your DNS cache regularly.
  • Use trusted DNS servers like Cloudflare (1.1.1.1), Google DNS (8.8.8.8), or OpenDNS.
  • Enable DNSSEC, if your ISP or DNS provider supports it.
  • Avoid public Wi-Fi without a VPN.
  • Run antivirus and anti-malware tools frequently.

For businesses and organizations, DNS security should be a top priority. One poisoned cache could redirect hundreds of users internally leading to data leaks or worse.

Proactively managing and flushing DNS isn’t just maintenance, it’s cybersecurity.

Troubleshooting DNS Cache Flushing Issues

Common Errors and Fixes

Sometimes flushing DNS doesn’t go smoothly. If you run into problems, here’s what to check:

  • Error: Access Denied
    • Run the command prompt or terminal as Administrator or with sudo.
  • Command Not Found
    • This usually happens on Linux or macOS if you’re using the wrong command for your distribution/version.
  • Still Not Loading Websites
    • Check your DNS server settings.
    • Reboot your router.
    • Try flushing your browser cache as well.
  • Persistent Errors
    • Malware could be interfering with DNS.
    • Run a full antivirus and anti-malware scan.

Rebooting and Network Settings Check

Sometimes, a simple reboot solves issues that flushing DNS alone can’t fix. If DNS errors persist after a flush:

  • Reboot your device.
  • Restart your router or modem.
  • Verify your device is using a valid DNS (like 1.1.1.1 or 8.8.8.8).
  • On mobile, reset network settings if needed.

Also, test the site from another device or network. If it works there, the issue is definitely with your local DNS cache or configuration.

Conclusion

Flushing your DNS cache is like hitting the reset button for your internet connection, it can resolve browsing problems, protect your privacy, and ensure you’re seeing the latest versions of websites. Whether you’re on Windows, macOS, Linux, Android, or iOS, the process is simple once you know the right steps.

By understanding what DNS cache is and how it impacts your internet experience, you’re better equipped to troubleshoot issues and maintain a smoother, faster online journey. Whether you’re a casual user or a web developer, knowing how and when to flush your DNS cache is a valuable tool in your digital toolkit.

So, the next time a website doesn’t load or you notice something sketchy with your internet, give your DNS a quick flush. Chances are, it’ll fix the issue before you even need to call tech support.

FAQs

1. Does flushing DNS speed up internet?

Not directly, but it can fix lag caused by outdated or incorrect DNS entries. If you’re visiting new websites after flushing, the system has to look up fresh addresses, which may slightly slow the first visit, but speed things up after.

2. Can DNS cache cause slow browsing?

Absolutely. A corrupted DNS cache can lead to wrong address resolution, timeouts, and slower browsing. Regular flushing ensures your system resolves domains accurately and quickly.

3. Is it safe to flush DNS cache regularly?

Yes, it’s completely safe. There are no risks involved in flushing your DNS cache. In fact, doing so can improve performance, boost security, and solve connection problems.

4. Do I need admin rights to flush DNS?

On most systems, yes. You’ll need administrative privileges on Windows, root access on Linux, or an admin password on macOS to flush the DNS cache successfully.

5. Will flushing DNS delete browsing history?

No, DNS cache and browsing history are separate. DNS cache only stores resolved domain-to-IP mappings. If you want to clear browsing history, you’ll need to do that from your browser settings.

🚀 Note: ServerAvatar is a powerful and user-friendly server & app management platform that takes the headache out of server configuration.

Whether you’re deploying WordPress, Laravel, N8N, or any PHP/Node.js app — it makes it insanely easy, even for non-tech users.

Forget the command-line chaos. Get a hands-off, streamlined experience that just works.

👉 Try ServerAvatar Now – It’s Free to Start!

Ready to Transform Your Hosting?

Join 1,000+ developers who’ve simplified server management with ServerAvatar. Get started for free and deploy your first server and application in minutes.
  • No Credit Card Required
  • Free $10 Server Credits
  • Deploy in next 10 minutes!