All Collections
How to flush DNS cache
How to flush DNS cache

Learn what a DNS cache is and why you may need to flush your DNS cache from time to time

Updated over a week ago

In this article, you'll learn about the following:

What is DNS cache?

Similar to web browsers, operating systems also store cache files of previous Domain Name System (DNS) lookups in what is called the DNS cache. The DNS cache consists of compressed information units called resources records (RR) about all visited websites, displayed in ASCII code.

A DNS cache consists of the following components:

  • Resource data: this section contains a record’s description, such as the address and hostname

  • Record type: this describes the record’s type (A or AAAA record)

  • Record name: this showcases the DNS entry’s domain name

  • Time To Live (TTL): this shows the resource record’s validity time measured in seconds

  • Class: this describes the resource record’s appropriate protocol group

  • Resource data length: this refers to the resource data’s value

When visiting a website for the first time, the user's operating system stores that site’s DNS cache files. It streamlines the DNS lookup process by resolving domains to their IP addresses, making web pages load faster the next time you visit the same IP address.

Why you should 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, they will answer content requests without going through the DNS server.

Despite this, using corrupt or outdated DNS cache files can lead to errors and security vulnerabilities. Your operating system may store a bad DNS cache when you visit websites that just moved to a new domain name or host. That's why it's recommended to flush your DNS cache periodically.

In general, you should clear your DNS cache regularly in order to:

  • Prevent search behavior tracking: storing DNS records makes it easier for hackers to predict your browser history

  • Keep your computer secure: DNS cache files are the main target for DNS spoofing, which endangers users’ sensitive information like login credentials and personal data

  • Solve technical problems: forcing the operating system to search updated DNS records can solve connection issues and incorrectly displayed web content

Ways to flush DNS cache (depending on your operating system)

Depending on your operating system, the steps to flushing a DNS cache may vary.

Microsoft Windows

Flushing your DNS cache on Microsoft Windows is a relatively simple process. Keep in mind that you need to run as an administrator when executing the command prompt to access all system security permissions.

Here are the steps to flushing DNS cache on Windows XP, 7, Vista, 8, 8.1, and 10:

  1. Press Windows+R keys together or right-click Windows’ Start menu and then click Run. Type cmd to open the Windows command prompt console. If you don’t have administrator privileges yet, run the cmd command by pressing Ctrl+Shift+Enter.

  2. Type ipconfig /flushdns on the command prompt and press enter. This command will clear DNS cache files on your computer and reset the DNS resolver cache.

  3. If the process is successful, you’ll see the confirmation message on your command prompt as follows:

    Screenshot showing confirmation message on Microsoft Windows


By default, Ubuntu doesn’t cache DNS records. If you manually install a DNS service like name service caching daemon (nscd), the steps below will show you how to flush DNS cache on your computer – just make sure to run as administrator:

  1. Press Ctrl+Alt+T keys together to open the terminal window.

  2. Enter the following command line to clear DNS cache files on the init.d subdirectory:

sudo /etc/init.d/nscd restart

You can flush the DNS cache on a system that uses systemd:

  1. Press Ctrl+Alt+T keys together to open the terminal window.

  2. Type the following command line:

systemd-resolve --flush-caches

Enter the following in the command prompt to check whether the previous command has successfully flushed the DNS cache.

systemd-resolve --statistics

Mac OS X

While the steps to flushing a DNS cache on Mac OS X are simple, you need to run the right command based on your current OS X version.

  1. Press the F4 key, then enter the terminal in the Launchpad’s search field to open the command terminal window.

  2. If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, the next step is to enter the following in the command prompt:

sudo killall -HUP mDNSResponder

To flush DNS cache on Mac OS X Yosemite, enter the command:

sudo discoveryutil udnsflushcaches

If you’re running on Mac OS X Snow Leopard, use the command:

sudo dscacheutil -flushcache

For Mac OS X Leopard and below, enter the following command to flush DNS cache:

sudo lookupd -flushcache

To flush DNS cache on Mac OS X High Sierra, enter this in the command prompt:

sudo killall -HUP mDNSResponder

Here is the command to flush DNS cache on Mac OS X Mojave:

sudo killall -HUP mDNSResponder

If you’re running on Mac OS X Catalina, use this command:

sudo killall -HUP mDNSResponder

Here is the command to flush DNS cache on Mac OS X Big Sur:

sudo dscacheutil -flushcache; 
sudo killall -HUP mDNSResponder

Flush your DNS cache in Google Chrome

As Google Chrome stores a separate DNS cache from the operating system on your computer, flushing them will have the same benefits. This is particularly important if you use Google Chrome as your main web browser.

Open Google Chrome and enter the following address into its address bar:


On the net internal settings page, select Clear host cache:

Screenshot showing how to clear host cache

NOTE: Keep in mind that this cache type is different from the browser cache

IMPORTANT: When you've finished flushing your DNS, reboot your router and your computer

Did this answer your question?