• Home
  • Inspiration
  • Design / Dev
  • Freebies
  • Deals
  • Home
  • Inspiration
  • Design / Dev
  • Freebies
  • Deals
CodeGrape Community Blog CodeGrape Community Blog
Input your search keywords and press Enter.
Inspiration

How to Clear DNS Cache on Windows, macOS, and Linux for Faster Troubleshooting

by codegrape / August 28, 2026

If you ever updated a website or changed DNS records for a domain or web hosting account, there is a good chance that you ran into an issue where the website wasn’t updated or loading properly. The reason for this is often because the new DNS records weren’t propagated yet or, more specifically, the domain wasn’t updated on your local machine.

The Domain Name System (DNS) is a database that stores the relationship between domain names and their IP addresses. To make browsing the web faster, your machine caches DNS records so that it doesn’t have to query the DNS server every time it needs to resolve a domain name. However, it’s not unusual that the DNS cache on your local machine contains incorrect information, especially when changes were made to a domain recently. Flushing DNS is a process of clearing your computer’s DNS cache so that it fetches the latest DNS information from the DNS server.

In this guide, you’ll learn what DNS cache is, why you should clear it, and how to clear the DNS cache in Windows, macOS, and Linux.

What is DNS Cache?

DNS cache is a database that your computer maintains and stores recently resolved domain names with their matching IP addresses.

When you first visit a website, your computer contacts a DNS server to retrieve the IP address for the domain you type in the address bar. To avoid querying the DNS server for the same domain names each time you want to visit a website, your computer caches the results of previous queries.

This helps websites load faster because it reduces the number of queries needed to get a domain’s IP address.

Why Should You Clear DNS Cache?

Even though DNS caching speeds up browsing, the information in the DNS cache can become out-of-date over time

You need to clear DNS cache when:

• A website is moved to a new server

• DNS records are changed

• Website hosting provider is changed

• SSL certificate is renewed or reinstalled

• You visit a website that displays an old version

• You get DNS related errors

• You cannot access a website that you know is online

• A website is malfunctioning

• You want to troubleshoot connection issues

Clearing the DNS cache will refresh the entries and ensure that the latest data is available.

How to Clear the DNS Cache in Windows?

The quickest way to clear DNS cache in Windows OS is to use the command prompt.

This will clear the resolver cache in just a few seconds.

Step 1: Open Command Prompt

Click the Start menu, search for Command Prompt, and select Run as administrator.

Step 2: Run the Flush Command

Enter the following command:

ipconfig /flushdns

Step 3: Verify the Result

If successful, Windows displays the following message:

Successfully flushed the DNS Resolver Cache.

Your computer will now request updated DNS records whenever you visit a website.

How to Clear DNS Cache on macOS

The command varies slightly depending on the macOS version, but modern releases use a similar process.

Step 1: Open Terminal

Navigate to:

Applications → Utilities → Terminal

Step 2: Run the Flush Command

For recent macOS versions, use:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Step 3: Enter Your Password

Type your administrator password when prompted.

Unlike Windows, macOS usually doesn’t display a confirmation message. If no errors appear, the cache has been cleared successfully.

How to Clear DNS Cache on Linux

Linux distributions use different DNS services, so the command depends on the system you’re using.

Using systemd-resolved

Many modern distributions such as Ubuntu use systemd-resolved.

Run:

sudo resolvectl flush-caches

Alternatively, on some systems:

sudo systemd-resolve –flush-caches

Using nscd

If your system uses the Name Service Cache Daemon, restart it with:

sudo systemctl restart nscd

Using dnsmasq

For systems running dnsmasq:

sudo systemctl restart dnsmasq

After restarting the DNS service, your system begins using fresh DNS records.

How to Check Whether the DNS Cache Was Cleared

After clearing the DNS cache, try to check if the previously broken resource started working.

You can do it in several ways:

  • Reload the page or restart the browser.
  • Use another browser.
  • Test the IP address with nslookup.
  • Check propagation with DNS lookup tools.

If everything started working, it means that the cache was indeed the issue.

When Should You Flush DNS Cache

In most cases, there is no need to clear the DNS cache. However, it may be helpful in the following situations.

After changing DNS records

If you made any changes to A records, CNAME, MX, or DNS servers, you may want to clear the cache to ensure that your computer uses the updated data.

After website migration

If you moved your website to a new host, it may take some time for the propagated DNS records to resolve to the new IP address.

While troubleshooting a website

If your site is working for everyone except you, it may be helpful to clear the DNS cache to see if it resolves the issue.

After getting rid of malware

Malware may modify the host file or DNS settings, so it’s important to clear the cache after cleaning the system.

Does Clearing DNS Cache Make Internet Faster

In most cases, it won’t. Actually, it may slow down your computer after clearing because you have to wait for the new requests to be resolved.

However, it may improve the performance if you are trying to reach a site with an incorrect IP address because of a DNS error.

Browser DNS Cache vs Operating System DNS Cache

Modern browsers often have their own DNS resolver and cache. If clearing the OS cache didn’t help, try restarting the browser after emptying the browsing data.

Some browsers (e.g., Chrome) allow you to clear the internal DNS cache as well.

You can also try checking the website in the incognito mode to see if it helps.

Avoiding DNS Issues in The Future

There is no ultimate way to prevent DNS-related problems from occurring, but you can reduce the chances by following these recommendations:

  • Use trusted DNS providers
  • Keep the operating system up to date
  • Wait before making any DNS-related changes
  • Double-check everything before updating DNS records or migrating a website.
  • Restart the router after making any significant DNS-related changes.
  • Clear browser cache when testing website-related issues.

Conclusion

The DNS cache plays an important role in speeding up the domain resolution process, but it may also cause issues when the cached data is incorrect. Now you know how to clear the DNS cache on Windows, Mac, and Linux. You also understand why it’s important to clear it from time to time. After flushing the DNS resolver cache, you should be able to get rid of most of the DNS-related issues without affecting your servers. If you manage multiple sites and servers, consider using a web hosting control panel because it typically has built-in DNS management tools. It also allows you to make other website-related changes without having to log in directly to the server.

Clear DNS CacheCommand PromptFaster Troubleshooting
  • ♥4 40
  • Read More
  • Previous PostHow Wagering Requirements Affect Betting Bonuses and Withdrawals

Related Posts

From One Player to 1,000+: How Khora Scales Multiplayer World Models
August 7, 2026
The Do’s and Don’ts of Minimalism in Business
April 18, 2019
PICO Unveils new operating system PICO OS 6 for early access to developers
March 2, 2026

No Comments

Leave a Reply Cancel Reply

How to Clear DNS Cache on Windows, macOS, and Linux for Faster Troubleshooting

August 28, 2026

Continue Reading

How Wagering Requirements Affect Betting Bonuses and Withdrawals

August 21, 2026

Continue Reading

Top Qualities of the Best Synthetic Indices Robot for Beginners

August 11, 2026

Continue Reading

How to Choose the Best Inventory Planning Services for Your Business

August 11, 2026

Continue Reading

From One Player to 1,000+: How Khora Scales Multiplayer World Models

August 7, 2026

Continue Reading

Newsletter

Latest Posts

  • How to Clear DNS Cache on Windows, macOS, and Linux for Faster Troubleshooting
    August 28, 2026
  • How Wagering Requirements Affect Betting Bonuses and Withdrawals
    August 21, 2026
  • Top Qualities of the Best Synthetic Indices Robot for Beginners
    August 11, 2026
Corporate Business Card https://www.codegrape.com/ Corporate Business Card
https://www.codegrape.com/item/corporate-business-card/49184

#brand #business #card #cmyk #corporate #creative #psd
Clean Minimal Corporate Flyer Design https://www.c Clean Minimal Corporate Flyer Design
https://www.codegrape.com/item/clean-minimal-corporate-flyer-design/48844

#creative #flyer #corporate #liflet #stationery
Real Estate Flyer Template https://www.codegrape.c Real Estate Flyer Template
https://www.codegrape.com/item/real-estate-flyer-template/48818

#flyer #interior #design #agency #poster #mortgage
Qtheme - Photography Website Template https://www. Qtheme - Photography Website Template
https://www.codegrape.com/item/qtheme-photography-website-template/52831

#qtheme #simple #modern #html #bootstrap #photography #website #template
Corporate Business Flyer https://www.codegrape.com Corporate Business Flyer
https://www.codegrape.com/item/corporate-business-flyer/48800

#a4 #advertisement #agency #business #flyer #corporate #creative #psd
InstaMedia - Download From Instagram https://www.c InstaMedia - Download From Instagram
https://www.codegrape.com/item/instamedia-download-from-instagram/49516

#instagram #download #social #image #video #photo #tool
Tri Fold Brochure Design https://www.codegrape.com Tri Fold Brochure Design
https://www.codegrape.com/item/tri-fold-brochure-design/48594

#trifold #brochure #design #illustrator
Corporate Business Card https://www.codegrape.com/ Corporate Business Card
https://www.codegrape.com/item/corporate-business-card/48542

#stylish #modern #business #card #corporate #creative #design #elegant #trend
Follow on Instagram
  • Scripts
  • Themes
  • Plugins
  • Prints
  • Graphics
  • Mobile Apps

Copyright © 2026 CodeGrape. All Rights Reserved.