FernTool

How to change DNS on a Mac

On a Mac, DNS is set per network service (Wi‑Fi, Ethernet). Choose a server (see public DNS compared):

Cloudflare
1.1.1.1, 1.0.0.1 · IPv6 2606:4700:4700::1111
Google Public DNS
8.8.8.8, 8.8.4.4 · IPv6 2001:4860:4860::8888
Quad9 (blocks known malware)
9.9.9.9, 149.112.112.112 · IPv6 2620:fe::fe

macOS Ventura and later

  1. Open System Settings → Network.
  2. Click Wi‑Fi (or Ethernet), then Details… next to your network.
  3. Choose DNS in the sidebar.
  4. Under DNS Servers, click + and add 1.1.1.1, then 1.0.0.1. Remove old entries with − if you want only the new ones.
  5. Click OK.

Older macOS (Monterey and earlier)

System Preferences → Network → Wi‑Fi → Advanced → DNS, add the servers with +, then OK → Apply.

Terminal

networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1
networksetup -getdnsservers Wi-Fi

To go back to the router’s DNS: networksetup -setdnsservers Wi-Fi empty.

Flush the DNS cache

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Check it worked

Run scutil --dns | grep nameserver, or compare a domain’s records with the DNS lookup tool. If you use a VPN, its DNS usually overrides yours, which is what you want. Check for leaks with the VPN leak test.

To change DNS for every device in the house, change it on the router.

Frequently asked questions

How do I change DNS on a Mac?

System Settings → Network → Wi-Fi → Details → DNS, click + to add servers such as 1.1.1.1 and 1.0.0.1, then click OK.

How do I flush DNS on macOS?

Run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder in Terminal.

Why are my DNS entries greyed out?

Grey entries come from the router (DHCP). Adding your own servers with + overrides them.

More guides