Advertisement

How to Change DNS on a Mac (macOS)

DNS Settings

On a Mac the DNS address is changed in the Network section of System Settings. The setting is separate for each connection: a change made on Wi-Fi does not affect a wired connection.

The steps below are for macOS Ventura and later. On older versions the same setting is under System Preferences › Network › Advanced › DNS.

Advertisement

Steps

  1. Open System Settings from the Apple menu in the top left.
  2. Click Network in the sidebar.
  3. Select the connection you use: Wi-Fi or Ethernet.
  4. Click the Details button.
  5. In the window that opens, switch to the DNS tab.
  6. Click the + button under the DNS Servers list and type 1.1.1.1.
  7. Click + once more and type 1.0.0.1.
  8. Click OK.

Addresses shown in grey in the list come automatically from the router; once you add an address of your own they are not used. If you want another provider, the addresses are on the public DNS servers page.

Clearing the DNS cache

To make the change take effect at once, open the Terminal app and run this command. It asks for your administrator password:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Checking the change

Run this command in Terminal:

scutil --dns | grep nameserver

You should see the addresses you entered at the top of the output.

Going back

On the same DNS tab, select the addresses you added, remove them with the − button and click OK. The Mac goes back to using the addresses from the router.

For the browser only

If you do not want to change the system setting, you can turn on secure DNS in Chrome, Edge or Firefox. That setting only affects the browser and encrypts your queries: encrypted DNS in the browser.

On company or school Macs this setting may be locked by a management profile.

Advertisement