This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Flush DNS: How to Clear DNS Cache

Updated on February 3, 2025

5 Min Read

With the advent of digital integration, websites are ensured of an easy browsing experience, beneficial to users also. Here, the Domain Name System (DNS) lies underneath-the phonebook of the internet-converting user-friendly domain names into machine-readable IP addresses. However, while browsing, your device may cache obsolete or wrong DNS information, creating annoying connectivity issues or slow loading times.

Flushing your DNS cache is an easy but efficient fix for those annoying situations so that your system can fetch updated DNS information from the internet. This blog should discuss what DNS and DNS cache are, why it is important to clear your cache regularly, and an operating system-specific guide on how to do so. Apart from these, we will also look into ways on how Cloudways can help enhance the performance of your website.

What is DNS and DNS Cache?

DNS means Domain Name System, which is a way of converting user-friendly domain names like www.example.com into IP addresses like 192.0.2.1 in a hierarchical manner. This conversion is very essential as two computers communicate using the IP addresses.

DNS cache means temporary storage on your computer where recently resolved domain names are stored for a period of time. While visiting a website, the operating system records IP address information of that site, thereby shortening the response time for requests made for that particular site in the future. Caching is a means of improving performance, but it can cause problems when old and corrupted data are stored in the cache.

Why Clear DNS Cache?

Clearing your DNS cache can help resolve several issues:

  • Connectivity Problems: Outdated IP addresses can prevent access to websites.
  • Website Changes: If a website has changed its server or IP address, flushing the cache ensures you access the latest version.
  • Privacy: Regularly clearing your cache can enhance privacy by removing traces of previously visited sites.

How to Flush DNS on Different Operating Systems

Let’s see how to flush the DNS on different operating systems as shared below:

For Windows:

  • Press Windows + R to open the Run dialog.
  • Type cmd and press Enter to open Command Prompt.
  • In the Command Prompt window, type:
ipconfig /flushdns
  • Press enter after the command. Now you should see a message confirming that the DNS Resolver Cache has been successfully flushed.

For macOS:

  • Open Terminal on your system. You can find it in Applications > Utilities.
  • Depending on your macOS version, enter one of the following commands. For macOS Monterey or later:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • For older versions:
sudo killall -HUP mDNSResponder

Press Enter and provide your administrator password if prompted.

For Linux

Open a terminal window. Depending on your distribution, use one of the following commands:

For Ubuntu/Debian with systemd-resolved:

sudo resolvectl flush-caches

For systems using nscd (Name Service Caching Daemon):

sudo systemctl restart nscd.service
  • Press Enter to execute the command for flushing DNS cache.

Unlock Peak Website Performance

Cloudways Managed Hosting ensures lightning-fast performance, seamless scaling, and optimized DNS resolution—no slowdowns, no worries.

Verifying if the DNS Cache is Flushed

You can verify if the DNS cache is flushed or not by the following methods. We have covered both GUI and Terminal Methods in order to help you resolve it.

Verify DNS Cache Flush via Terminal

After flushing the DNS cache, it’s essential to verify that it has been cleared successfully:

In Windows

Open Command Prompt again & type the command:

ipconfig /displaydns

If you see no entries listed or only entries from before the flush, your cache has been cleared.

In macOS

In Terminal, you will need to type the following command:

sudo dscacheutil -cachedump --entries host

If there are no entries or only old entries appear, your cache has been flushed.

In Linux

For systemd-resolved, check statistics by using the following command:

sudo resolvectl statistics

The output should show a cache size of zero if flushed successfully.

Verify DNS Cache Flush via GUI

In Windows (GUI Method)

  • Open Control Panel and navigate to Network and Internet > Network and Sharing Center.
  • Click on Change adapter settings.
  • Right-click on your active network connection and select Status.
  • Click on the Details.
  • If you see an empty list or old entries under “DNS Servers,” it indicates that flushing was successful.

macOS (GUI Method)

  • Open System Preferences and go to Network.
  • Select your active connection (e.g., Wi-Fi).
  • Click on Advanced, then go to the DNS tab.
  • If you see no recent entries or outdated ones removed, flushing was successful.

Linux (GUI Method)

Some Linux distributions with Network Manager may have an option to clear the DNS cache directly from their settings interface:

  • Open your Network Manager and look for options related to DNS settings.
  • If available, find and click on an option like “Clear Cache” or similar.

Flushing DNS as a Non-Admin User

If you do not have administrative privileges on your machine, there are still options available for flushing DNS:

Windows (Non-Admin)

While you cannot flush the entire DNS cache without admin rights, you can use the following command to clear specific entries:

  • Open Command Prompt (no admin required) and execute the following command.
nslookup www.example.com
  • This command forces a new lookup and bypasses cached results.

macOS (Non-Admin)

On macOS, non-admin users can still clear specific entries:

Open Terminal and execute the following command:

dscacheutil -flushcache; killall -HUP mDNSResponder

However, if prompted for an admin password, you will need assistance from an admin user.

Linux (Non-Admin)

For Linux users without root access can use following commands to verify DNS cache flush:

Open a terminal and use dig or nslookup commands to query specific domains without flushing the entire cache:

dig www.example.com

This retrieves fresh data directly from the DNS server.

Using Cloudways to Manage Your Website

Cloudways offers robust features that can optimize your website’s performance further after clearing your DNS cache:

  • Reliable Hosting: Cloudways takes care of server management tasks such as updates and security configurations with our Managed Hosting Platform.
  • Auto-Healing Servers: This feature ensures that any downtime is minimized by automatically fixing server issues.
  • DNS Made Easy Add-on: Improve DNS resolution speed and reliability with Cloudways’ DNS Made Easy.
  • 24/7 Support: Their dedicated support team is available around the clock to assist with any technical queries you might have.

Thus, working with Cloudways could optimize the boosting of your website’s performance so that along with regular maintenance such as the flushing of one’s DNS cache, an efficiency online presence could be guaranteed for the users.

Conclusion

Flushing the DNS cache is one of the periodic maintenance steps that may be taken in an attempt to improve Internet connectivity and confirm you are pulling the latest available information online. You can easily clear the outdated data by following the steps described in this blog for different operating systems, using other ways for non-admin users.

The Cloudways hosting greatly enhances not only your website performance but provides complete peace of mind with added support and management features. Integrating all of these practices puts you at a good position both yourself and visitors’ online experiences.

Q. How often should I flush my DNS cache?

A. It’s advisable to flush your DNS cache whenever you experience connectivity issues or when websites have recently changed their server settings.

Q. Can I flush my DNS cache without admin rights?

A. Yes! You can use commands like nslookup or dig to bypass cached results even without admin rights on some systems.

Q. How do I verify if my DNS cache has been flushed?

A. You can verify by checking for empty entries using commands like ipconfig /displaydns on Windows or checking statistics with resolvectl statistics on Linux after performing a flush command.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Salwa Mujtaba

Salwa Mujtaba is a Technical Content Writer at Cloudways. With a strong background in Computer Science and prior experience as a team lead in Cloudways Operations, she brings a deep understanding of the Cloudways Platform to her writing. Salwa creates content that simplifies complex concepts, making them accessible and engaging for readers. When she's not writing, you can find her enjoying good music, reading a book, or spending quality time with her family.

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour