Mac Performance

How to Flush your DNS Cache on Mac

Most of the time, your Mac’s DNS cache isn’t something you need to worry about. It works quietly in the background, sending you to the right websites when you ask for them. But if it gets corrupted, then you can run into problems loading sites, with 404 errors being common. One solution is to clear your Mac’s DNS cache.

Before we start

If you’re flashing your DNS cache because you’re experiencing problems, you might have malware on your Mac. It’s worth running a scan with MacKeeper just to be sure.

  1. Open MacKeeper, and select Antivirus from the menu
  2. Click Start scan
  3. Wait for the scan to finish
  4. If MacKeeper finds any suspicious files, take the recommended actions

Hopefully, your Mac is free of malware, but you should always make sure it’s protected. You can try out MacKeeper for free, and you get one free fix to see what it can do.


Thankfully, you can flush DNS cache on Macs in just a few short steps. 

What is DNS cache?

To understand what a DNS cache is, you first need to know what DNS is. When you load a website, you connect to a DNS (Domain Name System) server online. This looks at the web address in your browser, and it then checks that against a database of IP addresses. These IP addresses tell your web browser where to find the server that contains that website. This process is called a DNS lookup.

The DNS cache is a temporary database on your computer of all the recent DNS lookups it’s carried out. This enables your browser to resolve these lookups faster, thereby cutting down web page loading times.


Why you should clear DNS cache

Over time, the DNS cache can become outdated or corrupted, leading to connectivity problems. It can also be affected by malware, causing your browser to take you to malicious sites or phishing schemes.


Flushing your Mac’s DNS cache can eliminate these problems. However, if you do find your browser redirecting to malicious sites, you should also run a malware scan on your Mac.


How to flush DNS cache on Mac

To flush your DNS cache on macOS Monterey and Big Sur:

1. Click the Spotlight search button or use Command+Space to do a search

menu bar spotlight highlighted

2. Type in Terminal, and double-click the Terminal application under Top Hit to open it

spotlight search terminal

Note: If you’re unable to open Terminal through Spotlight, navigate to Go > Utilities > Terminal or click Applications, open the Utilities folder and then double-click Terminal.

utilities folder terminal app highlighted

3. Once Terminal is open, enter this command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

terminal window

4. Enter your Mac’s password and then press Enter to clear the DNS cache

terminal window with password option highlighted

How to сlear the DNS in older macOS versions

Older macOS versions use different commands. To flush the DNS cache in these older versions, enter these in Terminal:

  • In macOS El Capitan or newer, run sudo killall -HUP mDNSResponder
  • For macOS Yosemite, enter sudo discoveryutil udnsflushcaches
  • In Mac OS Lion, Mountain Lion and Mavericks, the command is sudo killall -HUP mDNSResponder
  • In Mac OS Snow Leopard, enter sudo dscacheutil –flushcache
  • For MacOS Leopard, run sudo lookupd –flushcache
  • And in Mac OS Tiger, use lookupd –flushcache

Once you’ve flushed the DNS cache on your Mac, check the problematic website to see if the problem is fixed and you’re able to visit the site normally again.

Clearing browser caches with MacKeeper

Clearing browser caches regularly for all your browsers can be time consuming. With a cache clearing tool like MacKeeper, you can clean all caches automatically and get the job done in a snap.

MacKeeper can analyze any files that hog space on your Mac, while protecting you from accidentally deleting important system files.


To get clear your browser caches with MacKeeper:


1. Download and install MacKeeper on your Mac


2. Launch the tool and then go to the Cleaning section in the right pane


3. Click Safe Cleanup

mackeeper safe cleanup

4. Click the blue Start Scan button

safe cleanup start scan button highlighted

5. Next, check the Caches box, and click to select all the caches you want to clear. These include user caches, system caches, mail caches and browser caches

safe cleanup caches tab

6. Click the blue Clean Junk Files button to confirm your action. MacKeeper will clear all the browser caches and clean any junk files that prevent your Mac from working properly

safe cleanup clean junk files button highlighted

The bottom line

Clearing your Mac’s DNS cache can help when you’re unable to access a website and you’re not sure what’s causing the problem. With the detailed steps in this guide and cleaning/maintenance tools like MacKeeper, you can resolve the problem, get back to browsing the web and help your Mac run more smoothly.


How often should I flush the DNS cache on Mac?

There’s no recommended time span, but you can do it as often as needed without causing any harm to your Mac.

How do I check my DNS cache on a Mac?

To check DNS cache on your Mac:

  • Open the Console app, select your Mac and then enter any:mdnsresponder in the search bar
  • Open a Terminal window, and enter sudo killall –INFO mDNSResponder
  • Go back to the Console app and view the list of cached DNS records
  • You can also check DNS cache entries in your web browser. For example, if you’re using Chrome, enter chrome://net-internals/#dns in the address bar to view the current list of cached DNS records

Is it safe to flush DNS cache?

Yes, it’s safe to flush DNS cache on your Mac. Cached data is simply temporary storage, but flushing DNS cache too often prevents it doing its job of speeding up page loading.


Clearing your Mac’s DNS cache can help you hide your search behavior, protect against manipulation by cybercriminals and solve technical problems when accessing web apps. But there’s no point in doing it if you don’t need to.

How do I clear DNS cache in Safari?

Safari browser also keeps a DNS cache. When you restart the browser, it clears the cache automatically, but you can do the same manually without relaunching the app.


1. In Safari, go to Safari > Preferences in the menu bar

safari preferences

2. Click Advanced and then tick the Show Develop menu in menu bar box to enable the Develop menu

safari preferences Show develop menu in menu

3. From the menu bar, select Develop > Empty Caches. Once your browser cache is cleared, quit and relaunch the browser

safari empty caches

Read more guides:

Use your Mac to the fullest! Sign up and get:
Effective tips on how to fix Mac issues
Reliable advice on how to stay safe online
Mac-world news and updates

Thank you!

You’ll love exploring your Mac with us.

Oops, something went wrong.

Try again or reload a page.

Here’s another sign you need to upgrade your macOS ASAP:

30% off your MacKeeper subscription

Сopy the code now and use it in the MacKeeper checkout after the upgrade.

Copy Code

Please be aware that this code cannot be combined with any other discounts, offers, or promotions.


MacKeeper - your all-in-one solution for more space and maximum security.

Try Now


You’ve just unlocked
1 Free Mac Cleanup
  • Delete unnecessary system files and caches
  • Free up GBs of storage space
  • Easily find and delete duplicate files
Start Your Fix Now

Great! MacKeeper downloaded.

Now let’s install it on your Mac.

Here’s your download. Just click it to get started!

1. Open

Click above to open the MacKeeper file from your Downloads

first install step

2. Install

Select Continue to begin the installation

second install step

3. Complete

Hit Install to complete the installation

third install step

4. Enjoy

MacKeeper is all set to optimize your Mac

fourth install step