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· IPv62606:4700:4700::1111- Google Public DNS
8.8.8.8,8.8.4.4· IPv62001:4860:4860::8888- Quad9 (blocks known malware)
9.9.9.9,149.112.112.112· IPv62620:fe::fe
macOS Ventura and later
- Open System Settings → Network.
- Click Wi‑Fi (or Ethernet), then Details… next to your network.
- Choose DNS in the sidebar.
- Under DNS Servers, click + and add
1.1.1.1, then1.0.0.1. Remove old entries with − if you want only the new ones. - 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
- What is IPv6?
- How to find your IP address (every device)
- Public vs private IP address
- What is CGNAT (carrier-grade NAT)?
- How to hide your IP address
- How to find your PS5 IP address
- How to find your Xbox IP address
- How to find your smart TV’s IP address
- How to find your router’s IP address
- What is a good internet speed?
- Why is my internet slow at night?
- How to change DNS on Windows 11 and 10
- How to change DNS on your router
- Public DNS servers compared
- Why port forwarding isn’t working
- Keeping your internet on during load-shedding
- Fibre vs LTE vs 5G in South Africa
- How to check if a port is open
- How to create a strong password
- What is a user agent?
- How to find your MAC address
- What is a good ping?
- What is an IP address?