How to flush DNS cache on Mac

Your DNS cache acts like a memory that your Mac refers to when trying to figure out how to load a website.

Flushing the DNS isn’t a difficult task, but the process changes with every new operating system. We’ll walk you through the steps needed to reset your DNS on different macOS versions manually.

What is DNS cache

So what’s DNS cache? It’s a list of domain names attributed to your last-visited websites. It’s not the same as recent online history. Domain name information is coded in numbers, for example,

For example, when a website migrates to a new domain, its DNS address changes. Naturally, it becomes unreachable as your still Mac relies on the outdated DNS record. 

So, DNS cache is a logbook that translates this numerical information into human-readable website names. After you’ve cleaned the DNS cache, you may notice that some websites load slower — that’s perfectly normal. Your Mac has forgotten them and is trying to access them from scratch.

Why you should flush DNS cache

There are several reasons to flush DNS cache. The main one, though, is that it can help improve your browsing experience by making a browser you use faster. It can also enhance the performance of your browser due to emptying stored cache files.

How to flush DNS in one click 

As we’ve explained above, you can remove these outdated cache files manually. However, there’s an easier way — with an app. To our knowledge, the only app that does it is CleanMyMac X by MacPaw. This is a well-known Mac maintenance app that also is notarized by Apple.

Flushing the DNS cache just so happens to be in its arsenal of features to help you do this. To flush the DNS cache with CleanMyMac, all you’ll need to do is download it — you can do that here for free.

This option is found in the Maintenance tab when you install CleanMyMac X. See the screenshot above. When you click Run, the cache will be cleared automatically, and your internet settings should optimize.

Another thing worth trying is clearing the browser cache itself (not the same as clearing the DNS list). You can do it automatically for all browsers if you open CleanMyMac X.

This should potentially fix small access-related issues and free up space.

    1. Open CleanMyMac X.
    2. Click the System Junk tab in the sidebar.
    3. Look through the list of found items and click Clean.

    It should be pretty easy — everything should be back to normal. Or you can try one or more of the following methods.

    How to clear DNS cache manually

    Before we get started, note that resetting the DNS cache will interrupt active web browsing activity, so it’s worth closing your browser before performing a flush. 

    How to flush the DNS cache on macOS in Terminal

    Are you familiar with Terminal? If not, no problem. All you’ll need to do is open the Terminal app and paste in a couple of commands.

    1. Open the Launchpad in the Dock and type in Terminal in the search bar.
    2. Enter the following syntax at the command line:
    3. sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    4. Press Return, enter your password, and press Return again.
    5. Quit Terminal. 

    How to clear the DNS on older macOS versions

    The algorithm is the same; only the copy/paste command in the Terminal will be different for each OS.

    macOS or Mac OS X  versionTerminal command
    macOS Monterey
    macOS Big Sur
    macOS Catalina

    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

    macOS Mojave
    macOS High Sierra
    macOS Sierra
    OS X Mountain Lion
    Mac OS X Lion
    sudo killall -HUP mDNSResponder
    Mac OS X El Capitan
    OS X Mavericks
    sudo dscacheutil -flushcache;
    sudo killall -HUP mDNSResponder
    OS X Yosemitesudo discoveryutil mdnsflushcache;
    sudo discoveryutil udnsflushcaches
    Mac OS X Snow Leopard
    Mac OS X Leopard
    sudo dscacheutil -flushcache
    Mac OS X Tigerlookupd -flushcache

    How to flush DNS cache on Linux

    Before clearing the DNS cache on Linux, you need to ensure that systemd-resolved is active. Open a terminal window, and enter this command: 

    sudo systemctl is-active systemd-resolved

    If you see “active,” enter the command to flush the DNS cache:

    sudo systemd-resolve --flush-caches

    There’s no success message, but you can check whether that has worked by running the next command: 

    sudo systemd-resolve --statistics

    If you see that the Current Cache Size is at 0, you’ve successfully flushed all DNS cache.

    Clearing the DNS cache on Mac isn’t something you’ll have to do often, but it’s a good way to troubleshoot named server errors. Use the correct command for your operating system, and you’ll be able to resolve issues within seconds. If, for whatever reason, the command doesn’t work or you don’t feel confident using the Terminal, CleanMyMac X will do the job for you.

    Frequently Asked Questions

    When should you flush or reset the DNS cache?

    Flushing the DNS makes sense when you can’t open certain websites. Especially if they were perfectly available just a moment ago. You can also try this fix when your network slows down randomly or other network-related issues occur.

    What will happen if I flush my Mac’s DNS cache?

    Flushing the cache simply updates the entry on your Mac that corresponds to the server address. Next time you try to access this server — i.e., a website — it will load a bit slower, which is similar to clearing your browser cache.

    What are the alternatives to flushing the DNS cache on Mac?

    If the above methods seem too technical, you may try to do a hard refresh in your browser. Another way to refresh outdated DNS entries is to delete browser caches.

    Laptop with CleanMyMac
    CleanMyMac X

    Your Mac. As good as new.