To reset DNS on Windows, run ipconfig /flushdns to clear the cache, then set your DNS servers back to automatic with Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ResetServerAddresses in an administrator PowerShell. On a Mac, remove any custom entries from the DNS Servers list in System Settings > Network, then clear the cache with sudo killall -HUP mDNSResponder.
"Reset DNS" means different things to different people, so this guide splits it into three levels. Start with the first and only move on if the problem is still there. Each level is more disruptive than the one before it.
- Clear the DNS cache. Throws away old lookup results. Harmless.
- Return DNS servers to automatic. Undoes custom servers such as 8.8.8.8 that you or a program set. Safe, and easy to redo.
- Reset the network stack (Windows only). Rebuilds Winsock or TCP/IP settings. This one can erase static IP settings, so read the warning first.
Level 1: clear the DNS cache
Your computer remembers recent DNS answers. If a site moved, or a lookup failed once and the failure was remembered, the cached answer can keep you from reaching a site that works for everyone else. On Windows, from Command Prompt or PowerShell:
ipconfig /flushdns
It reports that the DNS Resolver Cache was flushed. On a Mac, in Terminal:
sudo killall -HUP mDNSResponder
That command prints nothing when it works. Linux and browser caches, and how to check what is in the cache, are covered in how to flush the DNS cache. If the page still fails after flushing and restarting your browser, go to level 2.
Level 2: set DNS servers back to automatic
When you change your DNS server by hand, the device stops using the servers your router or network provides. Resetting to automatic removes the manual entries, so the device asks the network for its DNS servers again (through DHCP, the same mechanism that gives it an IP address). This is the right fix if a custom server has gone down, a VPN or "DNS changer" app left its own servers behind, or a guide told you to change DNS and you want to undo it.
Windows 11: Settings
- Open Settings > Network & internet.
- Select Wi-Fi or Ethernet, then open the properties of the connection you use.
- Next to DNS server assignment, select Edit.
- Change Manual to Automatic (DHCP) and select Save.
Leave the IP assignment row alone unless you also want to change the device's IP address. The full dialog, including the encrypted DNS options, is described in how to change the DNS server on Windows.
Windows: PowerShell
In PowerShell started as administrator, first look up the name of your adapter (read-only):
Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, InterfaceIndex, ServerAddresses
Then reset that adapter. Use the alias you saw, such as Wi-Fi or Ethernet:
Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ResetServerAddresses
Microsoft's reference describes -ResetServerAddresses as resetting the DNS server addresses to the default value, and its example says this returns the interface to the DNS servers specified by DHCP. The same reference notes that statically set servers override any DHCP configuration for that interface, which is why a reset is needed to hand control back to the network. The command prints nothing when it works. Run the first command again to confirm: a router address such as 192.168.1.1 usually appears, or the list is empty if the network supplies servers some other way.
Windows: Command Prompt
The older netsh tool can do the same from an elevated Command Prompt:
netsh interface ipv4 set dnsservers name="Wi-Fi" source=dhcp
Use netsh interface ipv6 with the same syntax if you also set IPv6 servers.
macOS: System Settings
Apple's help page for DNS settings gives this path for a Mac:
- Choose Apple menu > System Settings, then click Network in the sidebar.
- Select the network service you use (Wi-Fi or Ethernet).
- Click Details, then click DNS. You may need to scroll down to find it.
- In the DNS Servers list, select each custom address and click the remove (minus) button under the list.
With the list empty, the Mac uses the servers the network provides. Apple's page lists the add and remove buttons only as icons and does not describe a save step, so check that the list is empty when you reopen the pane. If you are on a Mac with a VPN or a security app installed, they can push their own DNS settings; disconnect them while testing.
After changing servers, clear the cache again (level 1) so answers from the old server are not reused. Then test with nslookup example.com; the first lines show which server answered. If lookups still fail, DNS server not responding walks through the likely causes.
Level 3: reset the network stack on Windows
If DNS is automatic, the cache is clear and names still do not resolve, the fault may be in the Windows networking layers beneath DNS. Two commands exist for that. Run them in an elevated Command Prompt.
Reset Winsock
netsh winsock reset
Microsoft's netsh reference says this resets the Winsock catalog to a clean state, removing any custom layered service providers (LSPs) to resolve network problems caused by corrupted Winsock settings. It does not affect Winsock Name Space Provider entries. This is the milder of the two. It mostly helps when old security or VPN software left a broken component behind. Restart the computer afterwards so every program picks up the clean catalog.
Reset TCP/IP
netsh int ip reset c:\resetlog.txt
Microsoft's TCP/IP reset article gives this exact command and says a log file name must be supplied; netsh int ip reset resetlog.txt works if you do not want to give a path. It states that the command overwrites the registry keys SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and SYSTEM\CurrentControlSet\Services\DHCP\Parameters, which has the same effect as removing and reinstalling TCP/IP, and its procedure ends with restarting the computer.
Warning: Microsoft's sample log for this command shows entries such as an old static IP address, subnet mask, default gateway and name server being reset. If you configured a fixed IP address or custom DNS servers by hand on this machine, write them down first, because you will need to enter them again. On a normal home PC that uses DHCP, nothing needs re-entering.
Check that the reset worked
- Run
ipconfig /flushdnsonce more on Windows (or thekillallcommand on a Mac). - Run
nslookup example.com. A name and an address in the answer means resolution works. "Non-existent domain" for a site you know exists points to the resolver or a typo, not to your device. - Try the same site from a phone on the same Wi-Fi. If the phone also fails, the cause is the router or your provider, and no reset on your computer will fix it. Restarting the router clears its own DNS cache.
- Check for things that bypass the system setting: a VPN, a browser with "secure DNS" turned on, or an entry in the hosts file at
C:\Windows\System32\drivers\etc\hosts(Windows) or/etc/hosts(Mac).
Example output of a working lookup (the address will differ):
Server: router.lan
Address: 192.168.1.1
Non-authoritative answer:
Name: example.com
Addresses: 2606:4700:10::6814:179a
104.20.23.154
If you want to understand what happens between your device and the resolver, how DNS works explains the path of a lookup and where each cache sits.
Frequently asked questions
- What does it mean to reset DNS?
- It usually means one or both of two things: clearing the DNS cache, which holds copies of recent lookups, and returning the DNS server setting to automatic so your device uses whatever the router or network hands out. On Windows it can also mean resetting the network stack that DNS lookups travel through, with netsh winsock reset or netsh int ip reset.
- Will resetting DNS delete my files or saved Wi-Fi passwords?
- Flushing the cache and setting DNS servers back to automatic touch neither. The netsh int ip reset command is broader: Microsoft says it overwrites the TCP/IP and DHCP registry keys, which removes any static IP address, gateway or DNS settings you had entered by hand, so note them down first.
- Do I need to restart after resetting DNS?
- Not for flushing the cache or switching DNS servers to automatic. Microsoft's TCP/IP reset procedure ends with restarting the computer, and it is sensible to restart after a Winsock reset too.
- Does resetting DNS make my internet faster?
- No. A reset only helps when something is wrong, such as a stale cached answer or a bad DNS server entry. If you want lower lookup times, compare resolvers instead of resetting.