If a website will not load, a domain points to an old server, or your Mac keeps finding the wrong network address, clearing the DNS cache may help. DNS, or the Domain Name System, translates website names such as example.com into the numerical IP addresses computers use to connect. Your Mac temporarily saves these lookups so it can revisit familiar sites faster. When saved information is outdated or corrupted, a fresh lookup can resolve the problem.
On most recent versions of macOS, you can clear the DNS cache using Terminal. The process takes only a moment and does not delete your files, change your saved passwords, or erase your browsing history. Follow the steps below to flush DNS on your Mac, then use the troubleshooting tips if the issue remains.
How to Clear DNS on Mac Using Terminal
The quickest way to flush the DNS cache on a Mac is to run two commands in the Terminal app. These commands clear the system’s cached DNS records and restart the service responsible for handling DNS requests.
- Open Finder, select Applications, then open Utilities.
- Double-click Terminal. You can also press Command-Space, type “Terminal,” and press Return to open it with Spotlight.
- Enter this command, then press Return:
sudo dscacheutil -flushcache - Enter the next command and press Return:
sudo killall -HUP mDNSResponder - If macOS asks for your administrator password, type it and press Return.
When you enter a password in Terminal, macOS does not display letters, dots, or other characters. This is normal. Type the password carefully and press Return. Use the password for an administrator account on the Mac, not your Apple Account password unless they happen to be the same.
The commands usually finish without displaying a success message. That does not mean they failed. You can close Terminal after running them. Try loading the website or app that was having trouble; your Mac should now request fresh DNS information.
Which DNS Flush Command Should You Use?
For most modern macOS releases, including recent versions of macOS, the two-command method above is the standard approach. The first command clears the system’s directory-service cache. The second sends a signal to mDNSResponder, the macOS process that handles DNS and related name-resolution tasks, so it can refresh its state.
Online instructions sometimes show only sudo killall -HUP mDNSResponder. That command may be enough in some situations, but using both commands is a commonly recommended way to flush the macOS DNS cache. Commands can differ on very old releases of OS X, so check the instructions for your specific version if you are maintaining an older Mac. Avoid running commands from an unverified website just because they mention DNS.
To check which version you have, open the Apple menu, choose About This Mac, and look for the macOS version name and number. If you are unsure whether a command applies to your system, consult Apple Support or documentation for that exact release before using it.
What Does Flushing the DNS Cache Do?
DNS works like an address book for the internet. When you enter a domain name in a browser, your Mac asks a DNS server for the IP address associated with that name. The response is stored temporarily, allowing your Mac to reuse it instead of making the same request every time.
That saved information is useful, but it can become stale. For example, a website may move to a different hosting provider or change its IP address. If your Mac continues to rely on an older lookup, the site may not open correctly or may connect to the wrong destination. Clearing the cache removes the saved lookup so macOS can request current information.
Flushing DNS does not change your DNS provider, router settings, Wi-Fi password, or internet plan. It also does not clear cookies, saved logins, browser history, or the browser’s separate cache. It simply asks the Mac to obtain fresh DNS information the next time a name needs to be resolved.
When Should You Clear DNS on a Mac?
Clearing DNS can be a helpful troubleshooting step when a problem appears related to a website’s address lookup. Consider trying it if you notice one of these situations:
- A website was recently moved or updated, but your Mac still reaches an old page or server.
- A domain works on another device but not on your Mac when both use the same network.
- You see a DNS-related error, such as a message that a server’s address could not be found.
- A website becomes available after a network change on other devices, but your Mac continues to have trouble.
- You are testing website or DNS changes and need your Mac to request a fresh record.
Flushing DNS is not a guaranteed fix for every connection problem. If your internet connection is down, the website’s server is unavailable, or your DNS provider is having an outage, clearing the local cache may not help. It is still a simple, low-impact step to try before investigating more complex settings.
How to Check Whether the Problem Is DNS
Before changing settings, compare the affected website across a few situations. Try opening it in another browser on your Mac, then check it on a phone or another computer connected to the same Wi-Fi network. If the site fails on every device, the cause may be the website, router, or DNS provider rather than your Mac’s local cache.
If the site works on another device using the same network but not on your Mac, the Mac’s cache, browser, VPN, or network configuration could be involved. If it works on your Mac over a phone hotspot but not over your usual Wi-Fi, investigate the router or the DNS service assigned by that network.
You can also try a different website. If many unrelated sites fail, the issue is more likely to involve your internet connection or DNS settings. If only one site fails, it may be experiencing an outage, using a changed domain configuration, or being blocked by a security tool.
What to Do If Clearing DNS Does Not Work
If the site still does not load after you flush DNS, try these additional steps. Test after each one so you can identify what resolved the issue.
- Reload the page: Close and reopen the tab, or quit and relaunch the browser. A browser may retain its own DNS or page data separately from macOS.
- Try another browser: If the site works elsewhere, clear the affected browser’s cache or review its network settings.
- Restart your Mac: A restart can refresh network services and clear temporary connection problems.
- Restart your router: If multiple devices are affected, unplug the router according to its instructions, wait briefly, and reconnect it.
- Disconnect a VPN or proxy temporarily: VPNs and proxies can route DNS requests through a different service. Follow your organization’s rules before changing work-device settings.
- Check your DNS settings: Open System Settings, choose Network, select your active connection, and review its details. The exact labels can vary by macOS version. Do not change DNS server addresses unless you know which settings you need.
- Check for filtering software: Security apps, parental controls, and custom network tools may block or redirect DNS requests.
If you recently changed DNS server settings, reconnecting to the network or restarting the Mac may help apply them. For a work or school Mac, contact the administrator before changing DNS, VPN, proxy, or security settings; those may be required for access to internal services.
Does Clearing DNS Also Clear Browser DNS?
Not always. macOS maintains system-level DNS information, while some browsers and apps can keep their own temporary network data. That means flushing the Mac’s DNS cache may not immediately clear a browser’s independent cache or an app’s existing connection.
If one browser is the only place where a site fails, restart it first. You can also use that browser’s settings to clear cached files or its available network data. Be aware that clearing all browsing data may remove cookies and sign you out of websites, so choose the data types carefully. Browser menus and diagnostic tools change over time; use the current help information for your browser rather than relying on old instructions.
Also remember that DNS answers can be cached beyond your Mac, including by your router, internet provider, VPN, or the website’s own DNS service. A local flush cannot remove those remote copies. If a DNS change was made very recently, it may take time for the updated information to become available everywhere.
Is It Safe to Flush DNS on Mac?
For normal troubleshooting, flushing DNS is generally safe. It removes temporary lookup information; macOS will rebuild its cache as you visit websites and use network services. The first visit after clearing may take slightly longer while your Mac looks up the address again.
Use Terminal commands exactly as written, including spaces and punctuation. The sudo command runs an action with administrator privileges, so do not add extra commands or paste a long command line from an unfamiliar source. If Terminal reports an error, check your spelling and confirm that the command is appropriate for your macOS version.
Frequently Asked Questions
How often should I flush DNS on my Mac? You generally do not need to clear DNS on a schedule. macOS manages its cache automatically. Flush it when troubleshooting a specific name-resolution problem or after a relevant DNS change.
Will flushing DNS make my internet faster? Usually not. DNS caching is designed to make repeat lookups efficient. Clearing it may fix a stale record, but it is not a general speed boost and may briefly require fresh lookups.
Do I need to restart my Mac afterward? Usually, no. Running the commands is enough. A restart is an optional troubleshooting step if the problem continues.
Will clearing DNS delete saved passwords or browsing history? No. The Terminal commands above do not remove browser passwords, bookmarks, cookies, or browsing history.
Conclusion
To clear DNS on a Mac, open Terminal and run sudo dscacheutil -flushcache, followed by sudo killall -HUP mDNSResponder. Enter your administrator password if requested, then try the affected website again. Flushing DNS can resolve outdated lookup problems, but it will not fix every internet or website issue. If the problem persists, compare the site across devices, restart your browser or network equipment, and check VPN, DNS, and security settings carefully.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.