Write the reason you're deleting this FAQ
How to Block Ads with Hosts File
You may know how to block advertisements with an Adblocker browser extension, or addon. But did you know you can block ads with your system's host file? Before we get into blocking ads with a host file, lets focus on why you should block ads!
Benefits to blocking ads:
Finding your hosts file
- Advertisers won't be able to track your online activities, or habits
- Faster page load times
- Less of a chance in getting malware, adware, or even viruses/trojans
- Cleaner websites
- .. and many more benefits
To start the process, you'll need to locate where your hosts file is stored.
For Windows XP to Windows 10, the host file is located in this path:
For Mac OS, the host file is located in this path:
Finding Connection Blocks
You can either add your own connection blocks, or use a list that was already generated. To save time, I would suggest using an automatically generated list, you can find these lists on your favorite search by searching keywords such as "hosts file ad block". Be aware that some sites that hosts these files actually remove hosts if they are paid by advertising companies to do so!
Find a list that is untouched, such as winhelp2002.mvps.org
Blocking the Ads
It's quite simple to actually block connections. Here's an example of the hosts file:
To add a connection block you'll need the website domain, and that's basically it.
For instance, if I wanted to block ad.doubleclick.net, i'll add this to my hosts file as shown below:
We use "0.0.0.0" as it doesn't resolve anywhere, this can increase page times, as having "127.0.0.1" will constantly want to load localhost. Also, if certain programs use 127.0.0.1 this can create issues, so make sure to use 0.0.0.0 when adding connection blocks.
You don't have to block advertising websites, you can block any website connection. This method of blocking will also help you have a bandwidth limit, you can save your bandwidth, browse more and you don't have to pay your internet company more money!
If you have anything to add to this post, please post below! Give your thoughts on this blocking method. Do you use the hosts file to block ads?