How to use my PC's hosts file to block malware or spam?

Who I am
Shane Conder
Author and references

Next, we will see how to use the hosts file on my pc to block malware or spam. In this way we will greatly improve the security of our computer.

This is not exactly new, while surfing the internet we are constantly exposed to infect our computer with different types of computer viruses, which not only endanger the PC but also all the information we have stored in it.

That is why we will teach you how to use windows hosts file not just to block malware or dangerous websites. But also so that you can block any type of site you don't want to be available in any way.

This is something extremely positive since if you have children at home. You can block yourself from accessing certain sites such as those that focus on adult content, just to give an example.

Follow this tutorial to the letter and you'll quickly see that tweaking the file host to block what you want is easier than you can imagine. Let's begin.

How to use the hosts file to block malware

The hosts file can be used for block adult websites, malware, etc. So it's ideal to get an idea of ​​how we can use it, especially if we have children at home who use computers.

What is the host file? It's a plain text document that resides in an operating system folder that it checks every time it connects to a domain.

How can we block a web address? This process is easier than you can imagine. The only thing we need to do is open the file located at the following address: C: WindowsSystem32driversetc.

Once the host file is open, what we need to do is go to the bottom of it, without deleting anything and adding, for example:

Save your changes and restart your computer. If you try to access Instagram from any browser or application, you will not be able to do so. What we are doing is asking our computer that all traffic that should (under normal conditions) go to Instagram, go to the IP address which causes the upload to fail and has no results.

On the other hand, you should consider the best Antispyware and Antimalware programs, thereby extending the security of your computer equipment.

How to block malware with hosts file

So once we fully understand how we can edit the file to block websites. Now let's go a step further and use a collection of IP addresses created by Steven Black on GitHub.

What is it about? It is a collection of addresses that we should block because they are totally insecure. They are based on information gathered from trusted sites such as,, etc.

The current database has nearly 40 entries in total. They are organized very carefully so as not to repeat any addresses. These are addresses that we must block to improve the security of our computer.

To make matters worse. From GitHub I also organize everything by categories. This means you can block the type of malware you want without having to use the entire list.

What types of malware or suspicious sites does it block? Sites of: gambling, casino, adult content, adware, malware, fake news, phishing (brand or identity theft), among others.

You can see where the information was taken from to get to the conclusion of adding all addresses to the file. So the data it handles is detailed enough so that you can be as sure as possible that you are blocking really dangerous sites.

In any case, for all novice users, it is best to consider the best free and paid antivirus for Windows. This way, you can protect yourself from any viruses or threats.

add a comment of How to use my PC's hosts file to block malware or spam?
Comment sent successfully! We will review it in the next few hours.