How To Flush DNS Command In 2023

How To Flush DNS Command In 2023

How to Flush DNS Command - If you're having connection problems, flushing your domain name system (DNS) cache might be the answer.

How to Flush DNS Command – If you’re having connection problems, flushing your domain name system (DNS) cache might be the answer. While a DNS cache might help speed up loading times, it can also cause security difficulties.

Also read: 27 Best Chrome Extension For Web Developers In 2023

Each operating system has its own method for flushing the DNS cache. As a result, this post will show you how to flush DNS cache on various Windows, macOS, and Linux operating systems. We’ll also show you how to do this on Google Chrome.

How to Flush DNS Command in 2022

Finally, this post will discuss the advantages of cleaning your DNS cache on a regular basis.

What Exactly Is DNS Cache?

DNS cache is a temporary storage area in your operating system for past DNS lookups. When you search for an address on the internet, your web browser and operating system will cache the IP address and DNS data.

This technology speeds up the DNS lookup process by resolving domain names to IP addresses, allowing web pages to load faster on subsequent visits. A DNS cache is made up of compressed information units called resource records (RR) that include information about all visited websites and are presented in ASCII code.

The DNS cache’s components, which are frequently encountered in the DNS Zone Editor, are as follows:

  • The description of a record, such as the location and hostname, is contained in resource data.
  • Record type describes the sort of record (A or AAAA record).
  • The domain name of the DNS entry is displayed in the record name.
  • The validity time of a resource record is measured in seconds by its time-to-live (TTL).
  • The proper protocol group for the class resource record.
  • The length of resource data refers to the value of the resource data.

How to Flush DNS Cache

The steps for flushing a DNS cache may differ depending on your operating system. The instructions below will walk you through the process on Windows, Linux, and Mac OS X.

Windows XP, 7, Vista, 8, 8.1, and 10

Most versions of Windows will have the same technique on how to flush DNS cache. What command can be used to flush the local DNS cache on a windows computer? Keep in mind that you must run the command prompt as administrator to gain access to all system security permissions:

  • To open the Run window, press Windows + R.
  • To open Windows Command Prompt, type cmd.
  • Enter the following command after typing it:
ipconfig /flushdns
  • Windows will erase your DNS cache files and reset the DNS resolver cache automatically. If the operation is successful, the following confirmation message will appear in your Command Prompt console.

Important! To use the Run as administrator option more quickly, run the cmd command by pressing Ctrl + Shift + Enter. Please keep in mind that you will require administrative privileges to do so.

macOS 11 Big Sur, 12 Monterey, and Older Versions

Make sure to use the correct flush DNS command for your current OS version on macOS. As a result, the first step is to verify your macOS version by going to the Apple icon -> About This Mac.

Next, launch the command terminal by pressing F4 and typing terminal into the Spotlight search area. Then, type the command for your macOS version and hit Enter. If prompted, enter your admin password and press the Enter key once again to erase your DNS cache.

The following are the 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 by default cache DNS records. If you manually install a DNS service, you will need to flush DNS command in your computer. What command can be used to flush the local DNS cache on a windows computer?

To delete your DNS cache on Linux, use the Ctrl + Alt + T keys together to launch the Terminal application.

Enter the relevant command in the terminal window based on the service that your Linux system is running. The commands for Name Service Cache Daemon (nscd) and systemd are listed below.

How to Flush DNS Cache With nscd

To clear DNS cache files in the init.d subdirectory, run the following command:

sudo /etc/init.d/nscd restart

How to Flush DNS Cache With systemd

Run the following command:

systemd-resolve --flush-caches

Then, run the following command to see if the previous operation was successful in flushing the DNS cache.

systemd-resolve --statistics

Flush DNS Command in Google Chrome

Google Chrome keeps a DNS cache distinct from the operating system. To avoid connection issues, it is also necessary to cleanse your DNS cache in Google Chrome if it is your primary web browser. What command can be used to flush the local DNS cache on a windows computer?

Important! Keep in mind that this cache is not the same as the browser cache.

To clear the DNS cache in Google Chrome, follow these steps:

  • Launch Google Chrome and type the following into the address bar:
  • When you see the Host resolver cache option, select Clear host cache.

Important! If you’re using Microsoft Edge, use edge://net-internals/#dns.

Reasons to Flush DNS Command on Regular Basis

Most operating systems employ DNS caching to minimize the DNS servers’ burden during high traffic. The cache’s validity period is determined by its TTL. Operating systems will respond to content requests without going through the DNS server as long as the cache files are still valid.

However, faulty or out-of-date DNS cache files can cause errors and security flaws. When a site is transferred to a new domain or server, your operating system may keep a faulty DNS cache.

As a result, these are some of the primary advantages of clearing your DNS cache on a regular basis:

  • Prevent search behavior tracking by not retaining DNS data, which allows hackers to trace your internet searches.
  • Improve security by avoiding the exposure of critical information from DNS spoofing, such as login credentials and personal data.
  • Resolve technical issues by pushing the operating system to look for updated DNS records, which can aid in the resolution of connection issues and wrongly displayed online content.

Final Thoughts

When you have connection problems or view wrongly displayed web pages, it is possible that your system is holding faulty or outdated DNS cache entries. You can rapidly resolve the issue by using the flush DNS command. If this does not cure the problem, try clearing your web browser’s cache instead.

We hope this post was useful in resolving DNS server issues. Best wishes.

The WordPress Learning Hub

Related Posts