How to flush DNS cache on Mac

When you flush DNS cache on Mac, macOS forgets the website addresses it remembers and looks them up again. It helps when a site moved to a new server or opens for others but not for you, and it deletes no files and frees no disk space. This guide also covers Chrome, which keeps a DNS cache of its own, and what to try if the site still doesn’t open.

What the DNS cache is

When you open a site, your Mac asks a DNS server for the site’s address and remembers the answer for a while. If the address changes, the Mac may keep using the old one until the remembered answer expires. Flushing the cache makes it ask again.

How to flush DNS on Mac

  1. Open Terminal: Applications › Utilities › Terminal, or press Command-Space and type Terminal.
Finder, Applications › Utilities with Terminal selected
  1. Copy the command below, paste it into Terminal and press Return.
  2. Enter your Mac password when asked. Terminal shows nothing while you type it. Press Return.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Terminal with the DNS flush command asking for the password

The command prints nothing when it works. Its first part clears the macOS directory service cache, the second tells mDNSResponder, the process that looks up addresses, to drop its cache. Then open the site again.

Apple’s own article on this, “Reset the DNS cache in OS X”, is archived and stops at old OS X versions. For those since 10.10.4 it gives sudo killall -HUP mDNSResponder, the second part of the command above. Neither part changes your settings.

Clear DNS cache in Chrome

Safari uses the macOS cache, but Chrome keeps a DNS cache of its own. Open chrome://net-internals/#dns and click Clear host cache. Quitting and reopening Chrome clears it too.

Chrome’s net-internals DNS page with the Clear host cache button

If the site still doesn’t open

  • Quit and reopen the browser, then restart the Mac.
  • Try the site on another device or another network to see whether the problem is on your side.
  • If you set DNS servers by hand in System Settings › Network › Wi-Fi › Details › DNS, check that they are correct.
  • A VPN or a security app may use its own DNS: turn it off for a moment and try again.

Keep your Mac tidy

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned

MacWashing doesn’t touch the DNS cache: it lives in memory and frees no disk space, so use the command above. For space, System Junk clears the caches apps keep on disk, from browsers to messengers, plus logs and leftovers of deleted apps.

Free trial · macOS 14 or later

Questions and answers

How do I clear DNS cache on Mac?

Run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder in Terminal and enter your password. Restarting the Mac clears the cache too.

Is it safe to flush DNS on Mac?

Yes. It deletes no files or settings. The first sites you open afterwards may take a moment longer while the Mac looks up their addresses again.

How often should I flush DNS?

Only when a site doesn’t open or still shows its old version after a move. The cache refreshes itself, so there is no need to flush it on a schedule.