The Hosts file is a part of your computer’s operating system that maps hostnames to IP addresses. It is a plain text file, but it doesn’t have any extension. It is available on every operating system like Windows, Mac, Linux, etc. The Hosts file converts the host name to IP and vice versa. So the browsing and opening other networks by ‘name’ will be smoother by avoiding DNS server requests.
What Can You Do with the Hosts File?
There are lots of things you can do with the Hosts file, such as it allows you to:
Before, you can easily modify the Hosts file in previous Windows versions by using the “edit” command via Command Prompt. However, this procedure no longer works in Windows 8.1 and 10, and when you try it, you’ll get the error message “Edit is not recognized as an internal and external command, operable program or batch file.” This is because the ‘edit’ command works on the 32-bit Windows OS only. However, there are two existing methods that you can try in order for you to be able to edit Hosts file in Windows 10 successfully.
NOTE: Before you proceed, make sure you are logged in as administrator on the PC. For security reason, some antivirus programs including Windows Defender may not allow you to modify Hosts file in Windows 10. In this case, it is advisable for you to temporarily disable any antivirus program running on the PC first before performing the steps below.
OPTION 1: Edit Hosts File via Command Prompt
STEP 1: On your computer, right-click the Start menu, then select the Command Prompt (Admin) option.
STEP 2: When the Command Prompt window opens, type the command: cd drivers\etc then press [Enter].
STEP 3: On the next line, type the command: notepad hosts then press [Enter].
NOTE: This will now open the Hosts file via the Notepad program with Administrator access.
STEP 4: Once you have made the necessary changes, simply press the key combination [Ctrl] + [S] to save the file.
STEP 5: If you would like to block a website, put a wrong IP address of that website, then the website name of that IP. (sample format below)
OPTION 2: Edit Hosts File Without Admin Rights and Command Prompt
If you’re not comfortable doing the procedure using the Command Prompt and don’t know the proper way to enable admin access to command prompt, follow the steps here.
STEP 1: On your computer, go to the Hosts file location: C:\Windows\System32\Drivers\etc
STEP 2: Right-click on the hosts file, then select Open with, and then choose the Notepad program.
STEP 3: Proceed with editing the Hosts file according to your requirements.
NOTE: Since you currently don’t have admin access, you will not be able to save this file.
STEP 4: Save the hosts file on another location, such as your Desktop or any any drive you want.
NOTE: Make sure that you are saving it as “hosts” for the filename, and that the file type is set to All Files to save it without any extension.
STEP 5: Next, copy or cut the modified Hosts file (from the location where you have just saved it), then paste it on its correct location (which is C:\Windows\System32\Drivers\etc).
STEP 6: Overwrite the existing file, when prompted.