macOS Ventura and later

Flush DNS Cache on macOS

Clear your Mac's DNS resolver cache using terminal commands.

Why Flush DNS on Mac

macOS maintains a DNS cache just like Windows. When DNS records change or you switch DNS providers, the old cached values can cause connection errors. Flushing the cache forces macOS to fetch fresh DNS records.

Common reasons to flush DNS on Mac: websites not loading after changing DNS, DNS errors in browsers, after removing malware, or when switching between networks.

The Universal Flush Command

Open Terminal (Applications > Utilities > Terminal, or search with Spotlight) and run this command:

sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

This command works on all macOS versions from Yosemite (10.10) through the latest macOS Sequoia. Enter your Mac password when prompted. The command completes silently — no output means success.

The first part (dscacheutil -flushcache) clears the DNS cache. The second part (killall -HUP mDNSResponder) restarts the DNS service to ensure a clean state.

macOS Version-Specific Commands

If you are on an older macOS version, the flush command differs slightly. For macOS Big Sur and later, use the universal command above. For macOS Catalina through Mojave, use: sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

For macOS Sierra through Yosemite, the command is: sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

In practice, the universal command works across all modern macOS versions. Use it unless you have a specific reason to use a version-specific variant.

Browser DNS Cache on Mac

Safari does not have a separate DNS cache to clear. Chrome and Firefox maintain their own caches. In Chrome, visit chrome://net-internals/#dns and click "Clear host cache". In Firefox, go to about:networking#dns and click "Clear DNS Cache".

For most users, flushing the macOS DNS cache is sufficient. Browser-specific cache issues are rare.

After Flushing — Verify

After flushing DNS, test your connection by visiting a few websites. If you recently changed your DNS provider, run a DNS speed test to verify the new settings are working correctly.

You can also verify DNS is working by running nslookup google.com in Terminal. It should return the IP address of the DNS server you configured.

Frequently Asked Questions

Is it safe to flush DNS on Mac?

Yes, completely safe. The cache repopulates automatically as you browse. No restart is required.

Do I need sudo to flush DNS?

Yes, the flush command requires administrator privileges because it modifies system-level caches. Use sudo and enter your password.

Test Your DNS Speed