# How to clear DNS cache in Windows, macOS and Linux

**URL:** https://www.compsmag.com/blogs/how-to-clear-dns-cache-in-windows-macos-and-linux/
**Author:** Ayushi Chauhan
**Published:** 2022-03-29
**Updated:** 2022-03-29
**Categories:** Blogs
**Tags:** Blogs Daily, Computer Guides, Facebook tips and tutorials, guiderobert, Guides and Tutorials, guiding12, How To Guide, How To Guides, Linux Guides, Social tips and tutorials, Tips, Tricks, Windows 10
**Reading Time:** 3 min

---

This tip is about the how to clear DNS cache in Windows, macOS and Linux. So read this free guide, How to clear DNS cache in Windows, macOS and Linux step by step. If you have query related to same article you may contact us.

## How to clear DNS cache in Windows, macOS and Linux - Guide

You may need to flush or delete your DNS cache on your local computer when making DNS changes, especially when migrating your websites.  This is a pretty easy task to complete.  In most cases, restarting the computer also has a similar effect.  Open the command prompt in your Windows installation.  In Windows 10, just tap the Search button button on the taskbar, type cmd in the search box and select Command Prompt at the top.  On Windows 7 and Windows Vista, type cmd in the search box at the bottom of the Start menu and click Command Prompt when it appears in the results.  For XP, go to Start > Run > type cmd in the run box and press Enter.  The DNS cache can be corrupted due to various reasons including network attacks or viruses.

For example, instead of visiting www.facebook.com, your browser may redirect you to an IP address of a malicious website that an attacker has inserted into your computer's DNS records.  Or you may get a large number of 404 errors. Linux, Windows, and macOS store name resolution information in the form of a DNS cache.  it speeds up up project load times because the cache contains IP addresses for the queried domains.

## Steps to Flush DNS Cache on Windows:

First, open the Start menu and search for CMD.  Right click on the CMD and select 'Run as administrator'

This will open an elevated command prompt with administrative rights.

At the command prompt, type the command – ipconfig /flushdns

Wait a few seconds until you receive the success message.

To exit the command prompt, type 'exit' and press Enter button.

## Steps to Flush DNS Cache on macOS:

Well, macOS has different commands for each of its versions.  To clear DNS cache on macOS, you need to launch Terminal and run the command.  To start a terminal, go to Applications > Utilities > Terminal.  In Terminal, you need to run the commands based on the version you have.

MacOS 10.10.4 and higher: sudo killall -HUP mDNSResponder

For macOS 10.10.1, 10.10.2 and 10.10.3: sudo discoveryutil mdnsflushcache

MacOS 10.7, 10.8 and 10.9: sudo killall -HUP mDNSResponder

MacOS 10.5 and 10.6: sudo dscacheutil -flushcache

## Steps to Flush DNS Cache on Linux:

The process to flush DNS cache on Linux is a little different on Windows and Mac.  This is because each of the Linux distributions uses different DNS services.  So depending on your system packages you need to run the corresponding commands

### Flush the BIND server DNS cache:

sudo /etc/init.d/named restart

OR

### Clear NSCD DNS cache

sudo /etc/init.d/nscd restart

OR

### Flush DNSMASQ's DNS cache

sudo /etc/init.d/dnsmasq restart

OR

## Final note

I hope you like the guide How to clear DNS cache in Windows, macOS and Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.

---

*End of Article*