My Windows Hub

How to configure hosts file to block any website/IP in Windows 8?

You can configure hosts file to block any website or IP.

You can find Windows Hosts file in C:\windows\system32\drivers\etc\ location. Different unwanted contents coming from AD servers and malicious sites can put your PC in danger. If you search over internet you can get a list of such ad-servers and websites which are responsible for distributing malicious scripts and contents. But even if you do not open these sites directly, they can deliver malicious scripts to your machine through displaying ads in other sites. It is also possible you may be redirected to those sites from other websites. When you are launched to those sites, they start sending malicious script to your system without asking for any permission. Though use of a good Antivirus program can reduce these types of security risks, it will be better to take some additional precaution by adding those ad servers and site to your Hosts file to block them.

Windows 8 hosts file

Again some third party software after installation continuously tracks your usage pattern and other information and sends them to their web servers. If you do not like to be tracked and monitored continuously like this, you can add those servers too in your Hosts file to block further data communication with those servers. Many people often do this thing to block “check activation process” or “fake serial number detection” process of cracked software.

Windows Hosts file has other application too. You can block adult sites, social networking sites, downloading sites etc. so that your kids do not able to access them.

Follow the steps below to block any website, IP or ad server in your Windows 8 PC.

Steps to configure hosts file to block website/ip

1. Go to the following directory C:\windows\system32\drivers\etc. You will find Windows Hosts hosts file

2. Right-click on it and Open with any text editor like Notepad, Notepad ++ etc. The file will look like this:

Default Hosts File

3. Suppose you want to block a website or ad server e.g. You have to add : # malicious ad server

Save the modified file. [Text after “#” sign is used as remarks. This portion is flexible; you can write anything according to your wish.]

Modified Hosts file

4. Now, if any adscript, installed programs or any other website try to access, your system will check the Hosts file and will get the IP for the corresponding site. Now, is a universal Local IP address. Any request generate for these types of destinations (Universal Local IPs) do not leave local machine. So, the outgoing request will stop at your computer instead of going to the actual IP of that site. Thus the site will not load.


Nick is a Software Engineer. He has interest in gadgets and technical stuffs. If you are facing any problem with your Windows, feel free to ask him.