How To Edit Your Hosts File



How To Edit Your Hosts File:

On occasion you will need to edit the hosts file on your machine. Sometimes because of an attack or prank, and others so that you can simply and freely control access to websites and network traffic.


Hosts files have been in use since ARPANET. They were used to resolve hosts names before DNS. hosts files would be massive documents used to aide the network name resolution.

Microsoft kept the hosts file alive in Windows networking which is why it varies very little whether used in Windows, OS X or Linux. The syntax stays mostly the same across all platforms. Most hosts files will have several entries for loopback. We can use that for the basic example for the typical syntax.

The first part will be the location to redirect the address to, the second part will be the address that you will want to redirect, and the third part is the comment. They can be separated by a space, but for ease of reading are typically separated by one or two tabs. localhosts #loopback

Now let’s look at accessing the hosts files in the different operating systems…

Windows 8 or 8.1 or 10:

Unfortunately Windows 8 or 10 makes it annoying to open apps as administrator — but it’s not too difficult. Just search for Notepad, then right-click on Notepad in the search results list, and choose to run it as administrator. If you’re using Windows 10 this will be on the Start Menu.

If you’re using Windows 10, it’ll look more like this:


Once you’ve done so, open up the following file using the File -> Open feature.



Then you can edit as normal.

Windows 7 (Bascially same for vista):

To access the hosts file in Windows 7 you can use the following command in the Run Line to open notepad and the file.

notepad c:\windows\system32\drivers\etc\hosts


Once notepad is open you can edit the file. In this example we will block Facebook. To do this just enter in the following after the # mark.    www.facebook.com


Now that you have edited your Hosts file make sure to save it.


Now notice if we try to access Facebook in IE we can’t get to the page.


That’s it you are good to go, thanks to howtogeek for source.


Leave a Reply

Leave a Reply

Notify of

[…] How To Edit Your Hosts File […]

Lucas Suzigan

When I try to save I get access denied and I am administrator. How to solve? :/


Admin please accept my apology for posting non working video. But now its 100% sure working video.
Thank you.

Here is how to easily save edited/modified HOST file in windows 108.1/8/7

Simran Singh

when i click upon ‘save” button in notepad
afterwards, one dialog box open of notepad.exe – System Error
the program can’t start because api-ms-win-core-timezone-l1-1-0.dll is missing from your computer

how can i fix this give me some solution


I don’t see a thing with I open the hosts file with notepad++ or regular notepad.


[…]  Add this following entry into Hosts file: sd.iobit.com (How to edit Hosts. File) […]