How to block malicious websites using HOSTS file?

1. Why do you need to block certain websites?

Malwares are often bundled with browser hijackers. Browser hijackers redirect web browser to rogue websites. Some of the websites are simply annoying because they appear instead of every address you try to access. Some of the websites are dangerous because they are part of scams and they sell fraudulent products and services. And some of the websites opened by browser hijackers are able to infect visitors’ computers without any notification. A computer can be badly infected when a malicious website is visited.
There are other reasons to block some websites on a certain computer. Certain websites might be blocked by parents on child’s computer, employers may want to prevent employees from visiting work-unrelated sources, and some websites might be blocked on school computers.
Modifying machine’s HOSTS file is the easiest way to block unwanted websites.

2. What is the HOSTS file?

The HOSTS file is a list of web addresses. It basically tells your computer where to look for a certain website. When you type an address in the address bar of your web browser, it checks for instructions on the HOSTS file; if no record about a website is found, it opens a website for you. Otherwise, it opens a website from an IP address defined on the HOSTS file. If the address leads to, you won’t be able to access the website, because is an IP address of your computer. If is set as an address of a website, you will only be able to see it if your computer is a server.

3. How to block malicious websites using your HOSTS file?

a) Find and open the HOSTS file.

The Hosts file is located in WINDOWS\system32\drivers\etc.

Open the file using Notepad or any other text editor.

There are commercial and freeware applications dedicated to editing HOSTS file. However, there’s no big difference in editing the file via specific software and editing it using Notepad.

b) Type an entry about a website you want to block.

The entry must have two parts: an IP address and the address of the website you want to block. Choose as an IP address, leave a space and then type the address of the rogue website. Here’s an example:

If a browser hijacker or you will try to open the, you will see a blank page.