Reset Windows 10 Hosts File: Recreate it With These Steps
Easy manipulation of the Windows hosts file
4 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more
Key notes
- This file is essential in mapping hostnames to IP addresses on the Windows 10 operating system.
- Upgrading to a new version of Windows, malware infection, and incorrect edits are reasons to edit the file.
The hosts file is an essential component of your computer. If it has changed for some reason, don’t panic, you can quickly reset Windows 10 hosts file.
So, in this article, we’ll explore some common triggers of host file changes and show you how to set the default values for this file on the MS operating system.
What is a Windows hosts file?
The Windows hosts file is a text file in the Windows operating system that maps hostnames to IP addresses. It acts as a local DNS resolver and allows you to map domain names to IP addresses manually.
This file is usually used to block or redirect network traffic and can be helpful in a variety of scenarios, such as:
- Blocking ads – You can add entries to the hosts file that point to the IP address of ad servers, effectively blocking all ads from displaying in your browser.
- Website testing – You can use the hosts file to test a website before it goes live by pointing the domain name to a specific IP address.
- Redirecting traffic – You can redirect traffic from one domain name to another by pointing the domain name to a different IP address in the hosts file.
However, sometimes the hosts’ file can become corrupted or modified by malware, which can cause issues with network connectivity.
In such cases, resetting to its default state can be helpful. Here are some common reasons why someone may want to reset this file:
- Malware infection – Malware can modify the hosts file to redirect your web traffic to malicious sites or block access to legitimate sites. Resetting the hosts file can help to remove these malicious entries and restore normal network connectivity.
- Incorrect manual edits – If you have manually edited the hosts file and made an error, this can cause issues with network connectivity. Resetting the file can help to remove any incorrect entries and restore proper functionality.
- Upgrading to a new version of Windows – Upgrading to a new version of Windows can sometimes cause issues with the hosts file. Resetting the file can help resolve compatibility issues and restore normal network connectivity.
How do I reset my hosts file in Windows 10?
- Press Windows + E to open File Explorer and enter the following location:
C:\Windows\System32\drivers\etc
- Find hosts file, and rename it to host.bak (You may be required to take ownership of the file first).
- Press Windows + R, type Notepad, and hit Enter.
- Paste the following text in Notepad:
# 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
- Click on File, then Save As.
- Save it to the path below as hosts:
C:\Windows\System32\drivers\etc
How do I edit and replace the host file in Windows 10?
- In Windows search, type notepad, right-click on it, and choose the Run as administrator option.
- Now select File, then Open in your Notepad. Then navigate the path below, click on the hosts file, and choose Open.
C:\Windows\System32\Drivers\etc
- Now, you should be able to make the changes to your hosts you want to, and simply click on save when you are done.
Your hosts file is now back to its default values, but creating a backup copy of the hosts file is recommended, so you can easily replace it again if needed. For example, you can use your old hosts file as a backup and keep it in the Drivers folder next to the original.
Resetting your hosts file is a beneficial solution for fixing connectivity issues on your Windows computer. So, if your Internet connection is not as stable as it should be, use this method to fix it.
It is worth mentioning that your hosts file may sometimes be locked for editing. If this is the case, we’ve got your back. We have already compiled a list of solutions for this particular issue, which you can check in this guide.
Please use the comments section below if you have any comments or suggestions.