This guide shows you how to edit hosts file in Windows 10 and Windows 8.1 easily without any additional system tools. Hosts file is an important system file which maps the host/site names with it’s IP addresses. Basically it translates the host name to IP and IP to host name. So the browsing and accessing other network places/shares by ‘name’ will be smoother by avoiding DNS server requests. We can manually customize DNS name and IP address for specific sites in this file which will be helpful in several ways in Windows or Mac OS X. Hosts file is a plain text file without any file extension.
We used to modify the hosts file by ‘edit’ DOS command in earlier Windows operating systems, but the edit DOS command is not included in Windows 8.1 and 10. You would be getting the following error message when you try edit command in Windows 10/8.1 command prompt.
“ ‘edit’ is not recognized as an internal or external command, operable program or batch file.”
This is because of edit DOS command requires 16-bit QBASIC.EXE and it will not work on 64Bit version of Windows 8.1 and Windows 10. So how to edit the hosts file here?, we can use the built-in Notepad program for this purpose.
Let us Easily Edit the Hosts File in Windows 10 and 8.1
On Windows Operating Systems, the hosts file is located here ,
Make sure you have administrative access/privilege on the computer before attempting to modify it.
Important Note : Some of the Antivirus software including Microsoft Security Essential (Windows Defender) will not allow modifying hosts file as a security precaution. This is to prevent hosts file modification by any virus, spywares or malware. If you face this issue, you need to disable the Antivirus software temporarily or exclude the hosts file from the protection.
Method-1: Easily Edit the Host File in Windows 10/8.1
1) Open the command prompt as administrator.
Search ‘cmd’ on Windows 10 or 8.1 and right click on the Command Prompt and select ‘Run as administrator’.
2) On the opened command prompt, type ‘cd drivers’ ENTER then ‘cd etc’ ENTER as shown below. This is to go to the location where the host file is located.
Here is an example, if I need to block facebook on a PC, I can enter the wrong IP address and map it to facebook.com as we showed here.
Important Note: If you haven’t opened the notepad from ‘Run as Administrator’ command prompt, then you can’t save the Hosts file as shown above. Method-2 should be used in this case.
If you are not good in using command prompt, then this method will be handy in editing the hosts file in GU interface.
5) Browse the location of hosts file, it’s under C:WindowsSystem32Driversetc. Once you have located the file right click on it and open with notepad.
6) Modify the hosts file properly. Click Save to apply the changes.
7) Unfortunately you can’t save this file now, overwriting is not permitted. Therefore save the modified file to different location, make sure you are saving it as ‘hosts’ and selecting the file type as ‘All Files’ as shown below.
I have saved the new hosts file on my desktop.
8.) Now simply copy or cut the file (from Desktop in this case) and paste it at the correct location, C:WindowsSystem32Driversetc.
Since the same file is already available at this location, you need to accept replacing the existing hosts file.
Hope this guide will be helpful in editing the hosts file on the latest Windows 10 or earlier Windows 8.1 and 8 versions.