Jul 26, 2022
Jordana A. & Astari S.
How to Flush DNS Cache
If you have connection issues, flushing your domain name system (DNS) cache might be the solution you need. However, even though a DNS cache can help speed up loading time, it can also cause security issues.
The process to flush your DNS cache is different for every operating system. Therefore, this tutorial will guide you on how to flush your DNS cache using various Windows, macOS, and Linux versions. We will also share how to do this method in Google Chrome.
Lastly, this article will explain the benefits of regularly flushing your DNS cache.
Learn how to flush DNS cache and improve your security and connection with our video tutorial.
What Is DNS Cache?
DNS cache is a temporary storage of previous DNS lookups in your operating system. When searching for a specific address online, your web browser and operating system will cache the IP address and DNS records.
This method streamlines the DNS lookup process by resolving domains to their IP addresses, making web pages load faster for the next visit. A DNS cache consists of compressed information units called resource records (RR) about all visited websites, displayed in ASCII code.
The following are DNS cache’s components, which is often found in the DNS Zone Editor:
- Resource data ‒ contains a record’s description, such as the address and hostname.
- Record type ‒ describes the record’s type (A or AAAA record).
- Record name ‒ showcases the DNS entry’s domain name.
- Time-to-live (TTL) ‒ resource record’s validity time measured in seconds.
- Class ‒ resource record’s appropriate protocol group.
- Resource data length ‒ refers to the resource data’s value.
How to Flush DNS Cache
Depending on your operating system, the steps to flushing a DNS cache may vary. The tutorial below will show you how to do it on Windows, Linux, and Mac OS X.
Microsoft Windows XP, 7, Vista, 8, 8.1 or 10
With Windows, the process to flush your DNS cache will be the same for most versions. Keep in mind that you need to use the Run as administrator option when executing the command prompt to access all system security permissions:
- Use the Windows + R shortcut to open the Run window.
- Type cmd to open Windows Command Prompt.
- Type the following command and hit Enter:
- Windows will automatically clear your DNS cache files and reset the DNS resolver cache. If the process is successful, you’ll see the following confirmation message in your Command Prompt console:
Important! Run the cmd command by pressing Ctrl + Shift + Enter to use the Run as administrator option more quickly. Please note that you will need admin rights to do so.
macOS 11 Big Sur, 12 Monterey, and Older Versions
With macOS, make sure to run the correct flush DNS command based on your current OS version. Therefore, the first step is to check your macOS version by clicking on the Apple icon -> About This Mac.
Next, open the command terminal window by pressing the F4 key and entering terminal in the Spotlight search field. Then, insert the command specific to your macOS version and press Enter. If prompted, insert your admin password and click Enter key again to clear your DNS cache.
Here are the specific commands for each version:
macOS 11 Big Sur or 12 Monterey:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.11 El Capitan, 10.12 Sierra, 10.13 High Sierra, 10.14 Mojave, or 10.15 Catalina:
sudo killall -HUP mDNSResponder
macOS 10.10 Yosemite:
sudo discoveryutil udnsflushcaches
macOS 10.7 Lion, 10.8 Mountain Lion, or 10.9 Mavericks:
sudo killall -HUP mDNSResponder
macOS 10.6 Snow Leopard:
sudo dscacheutil -flushcache
macOS 10.5 Leopard:
sudo lookupd -flushcache
Unlike Windows and macOS, Ubuntu does not cache DNS records by default. If you manually install a DNS service, you will need to flush the DNS cache on your computer.
To clear your DNS cache using Linux, press Ctrl + Alt + T keys together to open the Terminal application.
How to Flush DNS Cache With nscd
Enter the following command line to clear DNS cache files on the init.d subdirectory:
sudo /etc/init.d/nscd restart
How to Flush DNS Cache With systemd
Use the following command line:
Then, enter the following command to check whether the previous command has successfully flushed the DNS cache.
Flush Your DNS Cache in Google Chrome
Google Chrome stores a separate DNS cache from the operating system. It is also essential to flush your DNS cache in Google Chrome if it is your default web browser to avoid connection errors.
Important! Keep in mind that this cache type is different from the browser cache.
Here are the steps to flush the DNS cache in Google Chrome:
- Open Google Chrome and enter the following line into the address bar:
- Near the Host resolver cache option click Clear host cache.
Important! Use edge://net-internals/#dns if you’re using Microsoft Edge.
Reasons to Flush DNS Cache Periodically
Most operating systems perform DNS caching to lessen the DNS servers’ burden during high traffic. Its TTL determines the cache’s validity period. As long as the cache files are still valid, operating systems will answer content requests without going through the DNS server.
However, corrupt or outdated DNS cache files can lead to errors and security vulnerabilities. For example, your operating system may store a bad DNS cache when a site just moved to a new domain or host.
Therefore, here are some of the main benefits of flushing your DNS cache regularly:
- Prevent search behavior tracking ‒ storing DNS records makes it easier for hackers to track your online searches.
- Improve security ‒ avoid exposing sensitive information – such as login credentials and personal data – from DNS spoofing.
- Solve technical problems ‒ forcing the operating system to search updated DNS records can help fix connection issues and incorrectly displayed web content.
When experiencing connection issues or seeing incorrectly displayed web pages, your system might be storing corrupted or outdated DNS cache records. You can quickly solve it by using flush DNS command. If doing so doesn’t resolve the problem, try to clear your web browser cache instead.
We hope you find this article helpful in solving DNS server issues. Good luck.