How to Reset Hosts File to Default on Mac and Windows PC

Written By Ankur Reviewed By How-to Mac 5 Min Read

When you encounter an iTunes error like 3194, network failures, or connectivity issues, it is recommended to edit the hosts file. If you have updated the file many times, the original version is gone. Of course, you would have ideally created a backup copy of the original, but in the event that you didn’t, here’s how to reset the hosts file to default in macOS and Windows.

What is the Hosts File? 

The simplest explanation is that it is a text file used by your computer to map a connection between an IP address and domain names. It can be edited to test certain network aspects or to troubleshoot connectivity issues. Of course, you should keep a backup of it before editing. But in case you do not, you can still recover the original version as explained below.

How to Reset the Hosts File Back to Default in macOS

On a Mac, the hosts file mostly contains nothing more than a couple of lines of active code. The rest of the stuff is just commented out (description of the hosts file itself).

To reset, we are going to open the hosts file in a text editor, replace the entire file with the default text and save it. That’s it.

  1. From the Finder, navigate to Go → Go to Folder.Click on Go and Select Go to Folder in Finder Menu on Mac
  2. Type this in the Go to Folder window: /private/etc/hostsWrite Path and Click on Go
  3. From the finder window, click and drag the hosts file to the desktop. (We are doing this because we can’t open directly and edit it.)Drag Hosts File from Folder to Desktop on Mac
  4. Double-click the hosts file (on the desktop), and it will open in TextEdit (or any default text editor on your Mac).Double Click on Hosts File on Desktop
  5. Erase everything in it by pressing Command + A to select all and then press the delete key.Delete Selected Text from Hosts File on Mac
  6. Copy the following piece of text and paste it into the hosts file.
    ##
    # Host Database
    #
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1	     localhost
    255.255.255.255	broadcasthost
    
    
    ::1		    localhost
    
  7. Save this file by clicking on the red close button. Or, click on File from the top menu bar and then select Save.Click on Close to Save Desktop Hosts FIle
  8. Open the Go to Folder window and open /private/etc/hosts again.Write Path and Click on Go
  9. Step #9. Drag the hosts file from the desktop back to the /private/etc/ folder.Move Hosts File from Desktop to Folder on Mac
  10. You will be asked about the existing hosts file. Choose Replace and authenticate with the admin password when asked for it.
    Replace Existing Hosts File in etc Folder on Mac
    Click on AuthenticateEnter Mac Password and Click on OK to Restore Hosts File Back to Default in macOS
  11. Restart the Mac to get things rolling again.Restart your Mac

How to Restore the Hosts File Back to Default in Windows

  1. Open Notepad on your PC
  2. Go to this page and copy the text of the hosts file for your OS version. Different hosts file contents exist for different Windows versions (although they vary slightly)
  3. Once you’ve pasted the text into Notepad, save the file as “hosts” – include the quotes. (this is because you don’t want to save the file as a .txt file). Save it on the desktop so that you can easily access it in the next few steps
  4. Now, open this location: %WinDir%System32DriversEtc You can do this by opening Run and pasting the location here
  5. Once the folder opens, drag and drop the hosts file from the desktop into the folder. You will be prompted to replace the file and then prompted for the admin password

With this huge update to the hosts file, you might want to restart your computer.

The hosts file is usually used just to map web addresses to specific IP addresses and to block websites (by re-directing/mapping them to invalid/incorrect IPs).

Signing off…

This is how you can reset hosts file to default. Once you change it to default, it may resolve some connectivity problems that you have with your computer.

You may like to check:

🗣️ Our site is supported by our readers like you. When you purchase through our links, we earn a small commission. Read Disclaimer.

By Ankur Staff Writer
Follow:
I have been an Apple user for over seven years now. At iGeeksBlog, I love creating how-tos and troubleshooting guides that help people do more with their iPhone, iPad, Mac, AirPods, and Apple Watch. In my free time, I like to watch stand up comedy videos, tech documentaries, news debates, and political speeches.
1 Comment