How to Flush the DNS Cache on a Mac (and When You Need To)

Network cables plugged into a switch

Quick answer: To flush the DNS cache on a Mac, open Terminal and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, then enter your password. Nothing is printed when it works. It makes your Mac look up website addresses again. It does not free up disk space.

Flush the DNS cache when a site will not load on your Mac but works on your phone, after changing DNS settings or networks, or when a site has moved servers.

The command

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

The first part clears the directory-service cache and the second restarts the DNS responder. You will be asked for an administrator password, and nothing appears as you type.

Check that it worked

The command prints nothing on success. To test, try loading the site again, or look up a name:

dscacheutil -q host -a name example.com

The lookup returns a fresh address from your current DNS server.

Clear the browser's own DNS cache

Chrome keeps its own host cache. In Chrome, open chrome://net-internals/#dns and click Clear host cache. Restart the browser if the site still fails.

If it still does not load

  1. Turn Wi-Fi off and on, or reconnect to the network.

  2. Check the DNS servers in System Settings ▸ Network ▸ your connection ▸ Details ▸ DNS, and try a different public resolver.

  3. Restart your router.

  4. Clear the browser cache. See How to Clear Cache on a Mac (App, Browser and DNS Cache).

SituationFlush DNS?
Site works on phone but not on MacYes
You changed DNS serversYes
A site recently moved hostsYes
Mac feels slowNo, see the slow Mac guide
Disk is fullNo, it frees no space

FAQs

Does flushing DNS delete anything?

No. It only clears stored website addresses.

Will flushing DNS speed up my Mac?

Not generally. It can fix lookups that fail or return old addresses.

Does flushing DNS free disk space?

No. For disk space see Mac Storage Full? A Complete Guide to Finding and Freeing Up Space.

Related guides

← Back to all articles