MacBook App Cleaner
HomeBlog › How to Flush the DNS Cache on a Mac

How to Flush the DNS Cache on a Mac

Published August 3, 2026 · 5 min read · By the MacBook App Cleaner team

In short: Sites loading the wrong page or refusing to connect after a domain moved? Your Mac may be holding stale DNS records. Here is the one Terminal command that clears them, when it actually helps, and why it is completely safe to run.

Every time your Mac looks up a website, it stores the answer for a while so it does not have to ask again. That store is the DNS cache, and most of the time it quietly speeds things up. Occasionally, though, a cached record goes stale: a site moved to a new server, your DNS settings changed, or a domain you just registered is not resolving yet. Flushing the cache tells your Mac to forget those old answers and look them up fresh. It is quick, and it does not touch any of your files.

When flushing the DNS cache actually helps

Clearing the cache is not a cure-all, so it helps to know the handful of situations where it genuinely makes a difference. Reach for it when you see one of these:

  • A website loads an old version or the wrong page after the site owner moved servers.
  • You just changed your DNS provider (for example to Cloudflare or Google DNS) and want your Mac to use it right away.
  • A domain you registered or pointed somewhere new is not resolving, even though it works on your phone over cellular.
  • You edited your /etc/hosts file and want the change to take effect.
  • You get "server not found" errors for a site that is clearly online elsewhere.

If a single site is down for everyone, or your whole connection is dead, the DNS cache is almost certainly not the problem. Check the site on another network or restart your router instead.

The command to flush the DNS cache on a Mac

On macOS Sonoma (14) and Sequoia (15), one line does it. Open Terminal (find it in Applications, then Utilities, or search with Spotlight), then paste this and press Return:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

You will be asked for your administrator password because of sudo. As you type it, nothing appears on screen, not even dots, which is normal. Press Return and the prompt comes back with no message. That silence means it worked. The command does two things: dscacheutil -flushcache clears the directory service cache, and killall -HUP mDNSResponder restarts the process that handles name resolution so it starts clean.

That single line covers both current macOS versions. You do not need a different command for Sonoma versus Sequoia, and you should not run anything that points at files inside /System. If you would rather not use Terminal at all, restarting your Mac flushes the cache too, just less surgically.

Why this is harmless

Flushing the DNS cache does not delete documents, settings, browser history, saved passwords, or anything you would miss. It only clears a lookup table that your Mac rebuilds automatically the next time you visit a site. The only thing you might notice is that the very next visit to each site is a fraction of a second slower while your Mac re-fetches the address. After that, everything is back to normal. There is no risk of data loss and nothing to undo.

Because the cache regenerates on its own, there is also no benefit to flushing it on a schedule. Do it when you are troubleshooting a specific resolution problem, not as routine maintenance.

A quick word on safe cleaning in general

The same mindset that makes a DNS flush safe applies to cleaning your Mac more broadly: understand what a step removes before you run it, and prefer changes you can walk back. When you delete files rather than clear a cache, the safest habit is to preview what will be removed, stick to user-level junk like caches and logs by default, and send anything you remove to the Trash so it is reversible. A permanent delete leaves you no way back; a trashed file sits there until you are sure you do not need it. Reversibility is the whole point.

Privacy deserves the same scrutiny. A cleanup tool has no legitimate reason to phone home, and you do not have to take anyone's word for it. Run a firewall like Little Snitch and watch whether an app makes outbound connections it should not. Silence there is exactly what you want to see.

If you want a cleaner that matches this approach

If you decide you want an app to handle the everyday junk, our top free pick is CoreSweep. It is free forever with an optional one-time Pro upgrade ($49, no subscription), sends removals to the Trash so they stay reversible, and ships with zero telemetry, so a firewall check comes back quiet. A strong best-value runner-up is SkoonMac, which is also free with a one-time $19 Pro. Either way, the DNS command above is all you need for stale-lookup trouble, and it stays free and built in.

Frequently asked questions

Is it safe to flush the DNS cache on a Mac?

Yes, it is completely harmless. Flushing the DNS cache does not delete documents, settings, browser history, or saved passwords; it only clears a lookup table that your Mac rebuilds automatically. The only thing you might notice is that the very next visit to each site is a fraction of a second slower while the address is re-fetched. There is no risk of data loss and nothing to undo.

What is the command to flush the DNS cache on macOS Sonoma and Sequoia?

Open Terminal and run: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. This single line covers both macOS Sonoma (14) and Sequoia (15), so you do not need a different command for each version. The first part clears the directory service cache and the second restarts the mDNSResponder process that handles name resolution so it starts clean.

When does flushing the DNS cache actually help?

It helps in a handful of stale-lookup situations: a site loads an old page after moving servers, you just switched DNS providers, a newly registered or repointed domain is not resolving, you edited your /etc/hosts file, or you get "server not found" for a site that is clearly online elsewhere. It is not a cure-all. If a site is down for everyone or your whole connection is dead, the cache is not the problem, and because it regenerates on its own there is no benefit to flushing it on a schedule.

The easy way to do this safely

If you'd rather not do it by hand, the two cleaners we rate highest run with a preview first and the Trash as a safety net — and neither sends any data off your Mac.

CoreSweep (free to use; Pro a one-time $49) is our top pick. SkoonMac (free; Pro $19 once) is the best-value runner-up. See the full comparison.

← All Mac cleaning guides · Back to the comparison