How to block ads. I mean completely block all the advertisement on the Internet or a web browser

Each of us would like to block all the annoying advertisement on the Internet. I will prompt how to do it qualitatively.

The most I love internet is because it was created on the basis of freedom, everybody could choose what website to visit, what data is received and will be sent to the target host and everything is open.

In order to completely block all the ads, it is necessary to do it bit by bit:

Choose and make a list of all the domain names which spread ads

Open the Developer toolbar in the Firefox browser. Choose the Network tab and open the website which contains ads:


Now can be seen all the requests made by the browser to open certain website, among them are ads requests too. It is necessary to go carefully through this list and determine the domain names in the Request URL field in the Headers tab for all ads requests made by the browser:


In the image above is seen that domain name should be blocked.

Then create a list containing all these ads domain names. Save this list to an external storage, this will save time for the future. This technique works for text, image, and video ads as well. Sometimes smart ads spreaders use proxy but it’s visible as well. Read Chrome Developer Guide for clearance.

Block these domain names by adding them to the hosts file

Every Linux, BSD, or Windows systems has the hosts file which allows to block any IP address or domain name. On linux or Unix-like systems hosts file are located here:


On Windows systems the hosts file are located here:


Just add lines following this template to your hosts file to block the domain names from the list:

# Website

As for instance, the part of the hosts file to block Google ads:

# Google

Choose HTML DOM elements which show ads on websites you visit

As for instance, let’s block ads on the Google search page ;). Open, choose ads block, click Inspect Element:


Now can be seen that ads are showing in the div which has id:


Block these DOM elements in your browser

It’s time to block found DOM elements using any browser style editor extension. I recommend Stylish, but any other will fit as wel. After installing Stylish, click Write new style and put this code there:

#taw #tvcap {

Use this guide for websites you visit and you will never see ads again.

P.S. Enjoy the Internet without ads.