Mac Performance

How to Flush 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 the DNS cache on your Mac.

 

You can flush the DNS cache on your Mac by using the Terminal app. However, the steps you should follow are different for older macOS versions (e.g. macOS Catalina) compared to the new ones like Sonoma and Ventura. But worry not, below we’ll cover it all for you.

 

Now, let’s look at the symptoms that suggest it’s time to clean the DNS cache in macOS, along with how you can actually do that.

 

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’s Antivirus just to be sure:

  1. Download MacKeeper.
  2. Open MacKeeper and select Antivirus from the menu.
  3. Click Start Scan.
  4. Wait for the scan to finish.
  5. 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. Try out MacKeeper and get one free fix to see what our professional antivirus software can do.

What is a DNS cache?

To understand what a DNS cache is, you first need to know what DNS is. When you load a website on your MacBook, 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.

How to check DNS cache on Mac

It’s important to check the DNS cache on your Mac before freeing up space, as you’ll then be able to determine whether you actually need to take action or not. Here’s how to check DNS cache in Mac before you delete anything:

  1. Open the Console app, select your Mac, and then enter any:mdnsresponder in the search bar.
  2. Open a Terminal window, and enter sudo killall –INFO mDNSResponder.
  3. Enter your password when prompted. Note that the password won’t appear on your screen, but if you type it correctly and press the Enter key, you should still be fine.
  4. Go back to the Console app and view the list of cached DNS records.

You can also see the DNS cache on your Mac via your web browser. For example, if you’re using Chrome, enter chrome://net-internals/#dns in the address bar to see the list of cached DNS records.

To see the DNS cache on your Mac, start by opening the Console app. Type any:mdnsresponder in the search bar and hit the Enter key.
Step 1. Open Console and type any:mdnsresponder
You will need to go to the Terminal app after opening Console. Here, type sudo killall —INFO mDNSResponder and again hit the Enter key on your Mac to continue.
Step 2. Open Terminal and type sudo killall –INFO mDNSResponder
An option to enter your password will appear, but the password won't show in the Terminal app when you type it. Still, type it as normal and hit Enter again
Step 3. Enter your password in Terminal
Go back into Console after performing the DNS cache requirements in Terminal. If you haven't recently cleared your DNS cache, you should find your records.
Step 4. Go back to the Console app and view your DNS caches
The process to see the DNS cache on your Mac in Chrome is different and quite simple. Open Chrome and type chrome://net-internals/#dns in the URL bar.
Step 5. In Google Chrome, type chrome://net-internals/#dns in the URL bar and hit the Enter key

Should you flush the DNS cache on Mac?

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.

 

Performing a Mac DNS cache reset can eliminate these problems. However, if you do find your browser redirecting to malicious sites, it’s not enough to clear cache on your Mac. Also, our team suggests you run a malware scan on your Mac with the help of MacKeeper’s Antivirus.

 

Here are some of the common internet browsing problems that you can fix when your Mac refreshes the DNS:

Now, let’s look at each of these issues—and how to prevent them—in further detail.

1. Prevent DNS spoofing

DNS spoofing involves a criminal using your DNS records to load malicious websites on your device. These redirects occur even when you type perfectly legitimate URLs, and they can lead to both fraud and performance-related problems for your computer.

2. Error 404

Error 404 is one of the most common internet browsing issues, and it typically occurs when a page on the website you’re trying to visit is no longer available. Although 404 errors are often reasonable, you can sometimes see the problem if you don’t regularly empty the DNS cache on your Mac.

3. Trouble accessing a website

Besides seeing 404 errors, web pages might take a long time to load if your DNS cache is full. Long loading times will become irritating over time and stop you from getting the information you require. So, it’s in your best interests to view the DNS cache on Mac and refresh when you feel like it’s becoming an issue.

Hint from our team:

 

If you’re having slow internet problems, you can perform numerous other steps to get back on track. For example, try turning off your VPN or resetting your Wi-Fi router.

4. Keep the user's search behavior private

When you surf the web, others can see your online activity—especially when you use a public Wi-Fi network. But even if you don’t, advertisers and other third parties can view your search information via your IP address. One way to tackle this is to clean the DNS cache on Mac. This way, advertisers will find it harder to see your search behavior, and so will your internet provider.

5. Prevent DNS record propagation

DNS propagation refers to the time required to update your online DNS records. If you want to remain more private online, clearing your DNS cache can stop propagation. The reason is that it takes time to successfully update your records.

How to clear DNS cache on Mac manually

The steps to empty the DNS cache on your Mac can vary depending on your macOS version. For your convenience, our experts have divided the instructions on how to perform the Mac delete DNS cache process for various iterations of macOS.

Delete your DNS cache in recent versions of macOS—Sonoma, Ventura, Monterey & Big Sur

For newer macOS versions (2020 and later), you’ll need to follow the instructions explained below:

  1. Click the Spotlight search button in the toolbar at the top. Alternatively, use Command+Space to do a search.
  2. Type in Terminal, and double-click the Terminal application under Top Hit to open it.
  3. Once Terminal is open, enter this command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.
  4. Enter your Mac’s password and then press Enter to clear the DNS cache.
Begin clearing the DNS cache on your Mac by going to the Spotlight app. You can access it via the search bar or by pressing command + S on your keyboard.
Step 1. Open Spotlight
 In Spotlight, type Terminal in the search bar. The app should then appear at the top of your search results, and you can tap on it to continue the process.
Step 2. Search for Terminal in Spotlight
If you don't want to use Spotlight, you can also go to the Utilities app. Here, Terminal should appear and you can open the app to commence the process.
Step 3. Alternatively, open Terminal via Utilities
Whatever the option you choosed to open Terminal, now it’s time to type the command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Step 4. Enter the Terminal command
When Terminal opens, type your password after entering the sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder prompt. Hit the Enter key after doing that to continue.
Step 5. Enter the password to confirm the action

Clear the DNS in macOS Catalina and older 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.
  • 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. If you’ve been wondering why your Safari is so slow and the problem persists post-DNS cache clearing, try other solutions. For example, delete needless extensions and close energy-consuming apps.

Flushing your Mac DNS cache: Easy and essential

You should see the DNS cache on Mac as a good starting point for solving issues you may have while browsing the web. For example, web pages that won’t load properly are often a symptom of a DNS cache that requires a clearout.

 

If clearing the DNS cache didn’t work, your Mac could have bigger problems that you must address. Malware might be one of these, and you can check for viruses and whatnot with MacKeeper’s Antivirus. Our tool automatically searches for and quarantines malware, enabling you to do the easy work of removing it and enjoying your browsing experience once more.

FAQs

1. How often should I flush the DNS cache on Mac?

There’s no recommended time span. You can purge your Mac’s DNS cache as often as needed without harming your device, and it’s a good idea to do it every six months or so.

2. Is it safe to flush DNS cache?

Yes, it’s safe to flush DNS cache on your Mac. Cached data is simply temporary storage. Having said that, you shouldn’t clear the DNS cache every day, as this would stop it from doing its job of making the page load faster.

 

Besides, 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 all the time if you don’t need to.

3. 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 > Settings in the menu bar.
  2. Click Advanced and then tick the Show features for web developers box to enable the Develop menu.
  3. From the menu bar, select Develop > Empty Caches. Once your browser cache is cleared, quit and relaunch the browser.
Flush the DNS cache in Safari on Mac by going to Safari > Settings. Here, you can tick the required box to continue the process
Step 1. Safari > Settings
Your next step for clearing the DNS cache on your Mac is going to the Advanced tab. Here, tick Show features for web developers.
Step 2. Advanced tab > tick Show features for web developers
When the Develop tab becomes visible, you can select Empty Caches in the top toolbar. Your DNS caches will then get deleted from your browser
Step 3. Develop > Empty Caches

Once you’ve cleared the DNS cache in Safari, you should find that your browser runs much more effectively than before.

 

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.

Contents

Unlocked

Need to flush DNS cache? Clear all the browser caches in a click!

Start Now
PC

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

Try Now

Read more

How to Clean Up Mac Yosemite
How to Clean Up Mac Yosemite
How to Uninstall Apps on Mac
How to Uninstall Apps on Mac
arrow

Run Application

step_1

Click Continue

step_2

Click Install

step_1

Your macOS version is lower than OS 10.11. We’d like to offer you MacKeeper 4 to solve the cleaning, privacy, and security issues of your macOS.