How to Clear the DNS Cache on a Mac

The Routing Corruption Vector

macOS maintains a hidden, system-level cache of Domain Name System (DNS) records. When you attempt to visit a website, the operating system checks this cache first to quickly translate the URL into an IP address, accelerating the connection. However, if a website recently migrated to a new server or updated its security infrastructure, your Mac’s cache may stubbornly retain the old, invalid IP address. This results in the website completely failing to load, even when you know your internet connection is perfectly stable.

How to Clear the DNS Cache

You must use the Terminal to aggressively flush the system’s routing tables and force macOS to request fresh IP addresses directly from the internet.

1. Open the Terminal application (you can find it in Applications > Utilities, or search for it using Spotlight by pressing Command + Space).
2. To clear the DNS cache on macOS 11 (Big Sur), macOS 12 (Monterey), macOS 13 (Ventura), and macOS 14 (Sonoma), execute the following command exactly as written:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

3. Press Enter. Because this is a sudo command, the Terminal will prompt you to enter your administrator password.
4. Type your password carefully (the characters will remain entirely invisible for security) and press Enter again.

The system will not display a confirmation message, but the cache is immediately purged. Any web browser on your Mac will now successfully locate the updated, correct server address for the problematic website.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.