The Hosts file in Windows 10, is used to map hostnames to IP addresses. This Hosts file is located deep down in the Windows folder. It is a plain text file, and the size of the original default Hosts file is around 824 bytes.
Hosts File in Windows 10
In this post, we will see its location and also how to manage, lock, or edit the Hosts file in Windows 10. We will discuss the following:
- Host file location
- Lock Hosts file to prevent hijacking
- Block website using the Hosts file
- How to edit the Hosts file
- Using free Hosts File Editor software.
Let us take a look at them.
Host file location
The Hosts file in Windows is located at the following location:
Lock Hosts file to prevent hijacking
Imagine clicking on www.thewindowsclub.com and seeing a completely different website load in your browser. Malware can redirect Web addresses on your computer by altering your Hosts file. This is referred to as the Host File Hijack.
To prevent Host file hijacks, you may navigate to it, right-click on it, select Properties and make it a Read-only file. This will lock down your Hosts file and prevent anyone or any malware from writing to it.
Block website using the Hosts file
To block a website using the Hosts File, simply add the following entry:
Although I do not do it, many users like to manually add entries to it in order to block the opening of one or more particular websites. Others, like to download and use List from well-known sources like mvps.org, to add entries that block malware sites from opening.
How to edit Hosts file in Windows 10
To edit the Hosts file in Windows 10:
- Open Explorer
- Navigate to \System32\drivers\etc\ location
- Locate Hosts file
- Right-click on it and select Notepad
- Make the changes and Save.
Now let us go into a detailed explanation.
To edit the Hosts file, navigate to the following folder location:
Here you will see the Hosts file. Right-click on it and select Notepad. Make the changes and Save.
But sometimes, even when you are logged on with administrative credentials, you may receive the following error message:
Access to C:\Windows\System32\drivers\etc\ hosts was denied
Cannot create the C:\Windows\System32\drivers\etc\hosts file. Make sure that the path and file name are correct.
In this case, type Notepad in Start search and right-click on the Notepad result. Select Run as administrator.
Open the Hosts file, make the necessary changes, and then click Save.
If you are looking for an easier way
Using free Hosts File Editor software
If you are looking for an easier way, you can use a free Hosts file Editor software.
1] Using HostsMan
While you can always manually manage or edit Hosts file manually, I would like to suggest that you use a third-party freeware tool like HostsMan to do it.
HostsMan is a feature-rich tool that lets you add, remove, edit entries in the Hosts file. It also lets you easily add third-party Hosts lists that help in blocking malware sites and lets you easily enable or disable the Hosts file. It includes a built-in hosts file updater & a hosts editor. It lets you scan the hosts file for errors, duplicates, and possible hijacks – and also lets you create an Exclusion list. One more useful feature it offers is the Hosts file backup manager. Backup your Hosts file to a safe place and use it to restore it, should the need arise.
Hostman also lets you Flush DNS cache, open Hosts with a text editor, count the number of hosts, find duplicates, replace IP, scan hosts for malicious entries, rearrange hosts, manage DNS Client Service and more. In short, it’s the only Hosts Manager that you will even need. You can download it from its home page.
2] Using SysMate Hosts File Manager
SysMate Hosts File Manager and is another tool that lets you do so. With Host File Walker you can add as many records to the system hosts file. It even lets you backup and restore the Hosts File.
3] Using Host File Editor tool
Host File Editor is another good tool that you can use. It has the following features:
- Enable and disable hosts file from the system tray
- Cut, copy, paste, duplicate, enable, disable and move entries
- Filter and sort host entries
- Backup and restore various hosts file configurations when switching between environments
- Ping endpoints to check availability.
You can download it from here. It offers a portable version too.
How to manually reset Hosts file back to default in Windows may also interest you.
If your browser has been hijacked, you might find this post on Browser Hijacking and Free Browser Hijacker Removal Tools helpful.