How to clear DNS cache on Mac 

Sometimes you may need to delete the DNS cache on your Mac after changing the host file or fixing a problem. Even though it requires the use of the command line, DNS flushing on a Mac is often considered an expert task. However, after reading this article, all Mac users should find the process quite simple.

How to Flush DNS Cache in macOS Ventura and Monterey

  1. Launch Spotlight (command + spacebar) → type and select “Terminal”.
  2. Paste the below command into the terminal. sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Press the return key.
  4. Enter your password.
  5. Click “Return”.

The password will not be visible in the terminal for security reasons.

Even if nothing appears on the command prompt screen, your DNS cache will be cleared as soon as you hit the return key.

What is a DNS cache?

Let’s first check what DNS is before moving on to the DNS cache. Simply put, DNS (Domain Name System) translates human-readable domain names like www.igeeksblog.com into human-readable IP addresses like 104.26.11.8.

A DNS cache is a temporary storage on a computer, smartphone, server, etc. that stores DNS records of previously visited domain names, such as a record for IPv4 addresses, AAAA records for IPv6, etc. It is often referred to as a DNS cache resolver. Depending on the time to live (TTL), DNS keeps records about a website and its addresses, which are stored in this dummy database. Essentially, a DNS cache is how your device tries to save time and effort by responding to a DNS query with a DNS entry already present in the temporary DNS cache instead of doing lengthy DNS lookups.

Why Should You Flush DNS Cache on Mac?

  • The larger the collection of cached addresses, the more you tell the online world about yourself. Therefore, it needs to be cleaned up.
  • Hackers can access your records and direct you to fake websites if they have access to the DNS cache.
  • Technical issues can be resolved by performing a DNS flush. For example, when stale entries result in an incorrect version of the website you are looking for. The connection to the web project is established after the reset and the corresponding DNS server responds to the query again.

FAQ

Flush DNS for Google Chrome browser only. Open Chrome → enter chrome://net-internals/#dns in Chrome’s address bar → click “Clear host cache”.

You can easily clear the Safari cache by following the steps in our article on clearing the Safari cache, history, and cookies on Mac.

Is it safe to flush the DNS cache?

Yes, clearing the DNS cache on your Mac is safe. While cached data is only temporary storage, flushing the DNS cache too frequently can affect website load times. Were you able to flush DNS on your Mac or are you having problems? Comment below and I will try to answer as soon as possible.

CDN CTB