[Easily] How to Edit Hosts File in Windows 10 and Windows 8.1

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.”

edit command error

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 ,

C:\Windows\System32\Drivers\etc

host file location in windows 10
C – is the drive Windows OS had been installed.

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’.

open command prompt 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.

host file in windows 10
3) Make sure you are in the correct folder path, it should be C:\Windows\System32\Drivers\etc. Type ‘notepad hosts’ to open the hosts file in notepad.

open hosts file in notepad
4) We assume that you know the content of the file. Type the IP address of the domain/host name you want to give, then name. You can see the examples in same file.

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.

how to edit host file in Windows 10 Once you have modified the file with appropriate settings, click Save from File menu. That’s it, we have successfully modified the hosts file in Windows 10/8.1 now.

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.

Method-2

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:\Windows\System32\Drivers\etc. Once you have located the file right click on it and open with notepad.

open with notepad in windows 8.1

6) Modify the hosts file properly. Click Save to apply the changes.

save host file

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.

save the host file

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:\Windows\System32\Drivers\etc.

Since the same file is already available at this location, you need to accept replacing the existing hosts file.

replace host file

Once you have replaced the file, the new edited hosts file will be active on your Windows 10 or Windows 8.1 computer. You can find the similar method but with more explanation at this site.

Hope this guide will be helpful in editing the hosts file on the latest Windows 10 or earlier Windows 8.1 and 8 versions.

Comments

  1. Ed W says

    Would people please stop saying that this does not work, of course it works. Read the article:

    “Make sure you have administrative access/privilege on the computer before attempting to modify it”

    If you do not understand that then you’re out of your depth. That is no-one’s problem but your own.

  2. EMERZON says

    simply run first NOTEPAD as administrator then click file>open then locate HOST at local disk>windows>system32>drivers>etc from there do any changes you want and just hit close and save

  3. says

    It appears that Windows 8.1 now sets the file attribute to ‘Read Only’. If you go into properties and uncheck the box, you can edit the file normally without having to go through the copy and paste procedure.

  4. Lf says

    Well, I have to shout out a big thank you. This has been the one, and only clearly illustrated, clearly explained way to edit the host(s) file in order to validate PS Elements 13. All the ‘troubleshooting ‘ posts they have in their forums, etc, reference the host file, but the ‘how-to’s’ were useless. One thing I found repeatedly were the references to disabling the AV, which made sense, They also said to turn off the firewall, etc. When people posted the their Windows Defender had a msg that the app had been turned off.. and therefore another AV program must be running… well, that happened to me , as well. So, I turned off MalewareBytes, but ran into the same thing, over and over and over. So, I did more research and discovered that depending on which Windows operating system you have, what year you bought it, Windows revamped Defender, and renamed it Security Essentials, and sometimes the OS had both programs, so, at one point, or another I must have activated Security Essentials, which effectively disabled Defenders. I don’t remember doing it, forgot all about Security Essentials, until today. So, I search my pc for it, turned it off, followed your extremely well composed instructions. I, too, got the ‘ administer rights’ msg, but I had the option to ‘continue’, so I did. The hosts file saved, and I opened PS Elements, and low, and behold, I was able to validate my purchase. I cannot thank you enough.

Leave a Reply

Your email address will not be published. Required fields are marked *