Advertisement

Reset Hosts File Back to Defaults in Windows

How to Reset Hosts File Back to Defaults in Windows

Every Windows version comes with a special Hosts file which helps resolving DNS records. In addition to your network configuration, the file can be used to define a domain=IP address pairing which will have priority above the value provided by the DNS server. If the Hosts file is changed from default, resetting it can help resolve some connectivity issues.

Windows 10 Reset Hosts File

You or a system administrator may have a number of reasons to modify the hosts file. For example, web devs can make their computer resolve a domain to a localhost address. If you have a home LAN, mapping a network device name to its IP address with the Hosts file will allow you to open the device by its name from File Explorer. This is useful when your network devices run a bareboned Linux distro which doesn't provide names Windows can recognize over the network.

Advertisеment

The Hosts file is just a regular text file which can be modified using any text editor. The only catch is that the editor app should be started elevated (as Administrator). The hosts file is located in the system directory, so non-elevated apps will fail to save it.

The Hosts file consists of lines of text. Each line must include an IP address in the first text column followed by one or several host names. Text columns are separated from each other by white space.  For a historical reason, <Tab> is often preferred, but spaces will also do the trick. Lines started with a hash character (#) are comments. Windows ignores blank in the hosts file.

If you suspect your Hosts file is giving you connection issues, you can reset it, as follows.

To Reset Hosts File Back to Defaults in Windows,

  1. Open the Start menu, and go to Windows Accessories.
  2. Right-click the Notepad app and select More - Run as Administrator.Run Notepad Elevated
  3. In Notepad, click the File menu - Open, or press the Ctrl + O keys.
  4. Navigate to the folder C:\Windows\System32\drivers\etc.
  5. Select "All Files" from the drop-down menu.
  6. Double-click the hosts file.Notepad Open Hosts
  7. Select all the file contents (Ctrl + A) and clear it (press Del).
  8. Paste the following to the file:
    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    # localhost name resolution is handle within DNS itself.
    #       127.0.0.1       localhost
    #       ::1             localhost
  9. Save the file(Ctrl + S).

You are done!

Related articles

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.