How-To

How to Change DNS on macOS

Change the DNS server on your Mac through System Settings, enable encrypted DNS with a profile, and flush the DNS cache from Terminal.

5 min read

Why Change DNS on Your Mac

macOS uses the DNS servers your router hands out, which usually come from your ISP (e& or Du). Switching to a faster, privacy-focused resolver can shorten the delay before pages load, block malicious sites, and — with an encrypted profile — hide your lookups from anyone on the network. If DNS is new to you, read What Is DNS first.

Change DNS in System Settings

  • Open System Settings → Network
  • Select your active connection (Wi-Fi or Ethernet)
  • Click Details… (or the "…" menu next to the connection)
  • Go to the DNS tab
  • Under DNS Servers, click the + button and add each server IP
  • Click OK, then Apply

On older macOS versions the path is System Preferences → Network → Advanced → DNS.

Recommended DNS Servers

ProviderPrimarySecondaryBest for
Cloudflare1.1.1.11.0.0.1Speed & privacy
Google8.8.8.88.8.4.4Reliability
Quad99.9.9.9149.112.112.112Security

Enable Encrypted DNS (DoH / DoT)

The built-in Network panel only sets plain DNS. To encrypt your queries, install a configuration profile: Cloudflare and NextDNS both provide a downloadable .mobileconfig file that enables DNS over HTTPS or DNS over TLS system-wide. Open the file, then approve it in System Settings → Privacy & Security → Profiles.

Flush the DNS Cache

Open Terminal and run these two commands together:

  • sudo dscacheutil -flushcache
  • sudo killall -HUP mDNSResponder

Enter your admin password when prompted. This clears any stale cached lookups.

Verify the Change

In Terminal, run dig @1.1.1.1 example.com or nslookup example.comto see which server answers. For Cloudflare, open 1.1.1.1/help in Safari to confirm. DNS changes don't affect bandwidth — measure that with a speed test, and see your full connection details on What's My IP.

Ready to test your speed?

Use our free tool to measure your connection in seconds.