Guide
How to flush the DNS cache on a Mac
Quick answer
Open Terminal from Applications › Utilities and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Type your Mac’s login password when asked and press Return. Nothing appears while you type, and nothing is printed when it’s done: the cache is empty, and the next visit to each site looks its address up again.
Levers flushes the DNS cache with one click from the menu bar, with no Terminal and no password to type.
How to flush the DNS cache on a Mac
- 1
Open Terminal, in the Utilities folder in Applications, or search for it with Command-Space.
- 2
Type or paste sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press Return.
- 3
Type the password you log in to your Mac with, and press Return. The letters don’t show as you type; that’s normal.
- 4
Nothing is printed when it works. Open the site again, or reload it.
Your account needs to be an administrator for sudo to work. Restarting the Mac clears the cache too.
Your Mac remembers the address behind every site name it has looked up, so it doesn’t have to ask again each time. When a site moves to a new server, or a lookup went wrong, the Mac can keep using the old answer. Flushing the cache throws those answers away and makes it ask afresh. It does nothing else: no settings change, nothing is deleted from your browser, and no app has to restart.
Ways to clear the DNS cache
| Way | No password to type | Apps stay open | One step |
|---|---|---|---|
| Terminal, with sudo | No | Yes | One command, then the password |
| Restart the Mac | Only to log in again | No | Yes |
| Levers’ Flush DNS Cache | Yes | Yes | Yes |
Yes Partly No
The Terminal command to flush DNS on a Mac
Two commands do it. The first empties the cache macOS keeps for directory lookups, which holds addresses too. The second tells mDNSResponder, the part of macOS that answers DNS lookups, to throw away what it remembers. It isn’t quit; it carries on with an empty cache.
Apple’s own note on resetting the cache, now archived, gives the second command for every version since OS X Yosemite. Running both is the usual advice, and costs nothing.
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder Both need your password because they change something only the system may change.
When does flushing the DNS cache help?
It helps when the problem is a wrong or stale address. Some signs:
- A site loads on your phone or another Mac, but not on this one.
- A site you run has moved to a new host, and your Mac still opens the old one.
- You changed your DNS servers or VPN, and some sites still behave as before.
- The browser says the server can’t be found, for a site you know is up.
Why did flushing DNS not fix the site?
Flushing only clears what this Mac remembers. If the site is down, if your network is off, or if your router or DNS provider is still handing out the old address, the Mac gets the same answer again.
Reload the page after flushing, then try another network, such as your phone’s hotspot. If the site loads there, the old address is coming from your router or provider, not from your Mac.
Is it safe to flush the DNS cache?
Yes. The cache refills itself as you browse, and the first visit to each site takes a moment longer while the Mac looks its address up. Nothing else changes, and there’s nothing to undo.
Or flush it with one click in Levers
We make Levers.
Levers sits in your menu bar. Click Flush DNS Cache and it runs both commands for you, the same ones as above, and says Flushed when they’re done.
- Flush DNS Cache
- No Terminal, and no password to type each time
- Both commands at once, in the right order
- A click away in the menu bar, or on a shortcut you choose
Good to know
- The first time, Levers installs a small helper that can flush the cache and set Low Power Mode, and nothing else. You allow it once in System Settings › General › Login Items & Extensions.
- Flushing can’t bring back a site that’s down, or fix an address your router is still handing out.
- Needs macOS 15 Sequoia or later.
- One payment, no subscription, with a 14-day refund.
Questions people ask
How do I flush the DNS cache on a Mac?
Open Terminal and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, then type your login password and press Return. Nothing is printed when it works.
Why does flushing DNS ask for a password?
Because sudo runs the commands as the system, and macOS asks for an administrator’s password before it does that. It’s the password you log in to your Mac with.
Does restarting a Mac clear the DNS cache?
Yes. A restart clears it as well. Flushing does the same without closing your apps.
Does flushing DNS delete my browser history or passwords?
No. It only clears the site addresses macOS remembers. Your history, cookies, passwords and settings stay as they are.
Is there an app that flushes the DNS cache on a Mac?
Yes. Levers flushes the DNS cache with one click from the menu bar, running the same two commands for you, with no Terminal and no password to type each time. It costs from $6.99, paid once.