How to Remove Google Text Ads

toggle-button

It seems that almost every web page you view these days has Google AdSense texts ads spread across the top or down the side.

These ads have never bothered me. They are easy enough to ignore and besides, website owners are entitled to earn a living just like the rest of us.

However, lately some sites have started embedding the Google ads in the center of the page or worse still, right in the middle of a block of text. So I decided enough was enough and started looking for ways to block the ads.

It turns out that it's dead easy to stop them. In fact there are many ways you can do it. For example install an adblocker extension into your browser such as AdBlock, AdBlock Plus or my fave, UBlock.

But perhaps the simplest and most universally applicable method is to use the Windows Hosts file to block the address of the Google ad-server.

There is another advantage in using this technique; it will help you develop an understanding of the Hosts file and its many uses.

The Windows Hosts file

This a file on your computer that can be used to locally translate the names of web sites into IPs. IPs are sets of four numbers separated by dots like 65.109.128.16. They are the real addresses of the internet not web site names (URLS). Names are only a convenience and have to be translated into IPs. For example, the name (URL) of this website is techsupportalert.com but its IP, its "real" address on the internet, is actually 69.16.226.16.

Normally this kind of translation takes place at your ISP. They have a special server dedicated to the task called a DNS server. Whenever you type a URL like www.techsupportalert.com into your browser address window, the DNS server translates the name into the corresponding IP 69.16.226.16. It's automatic and requires no involvement from you.

However, you can also do it locally on your own PC and that's where the Windows Hosts file comes into play.

The Hosts file is just a plain text file containing a simple list of web site names (URLs) and their corresponding IPs. Here's an example of what a Hosts file might look like:

216.109.118.69  www.yahoo.com
69.16.226.16    www.techsupportalert.com
216.239.115.141 www.cnet.com

You can think of this like an address book. In an address book you look up a name and find the address. With the Hosts file you look up a web site name (URL) and find the address (IP). In the example above, any reference to the name www.yahoo.com will be directed to the address 216.109.118.69.

Now, the Hosts file on most computers has nothing in it. That's fine because the DNS translation is usually handled by your ISP.

If your Hosts file does have entries then these are used for the DNS translation for those sites instead of your ISP's DNS server. This is actually fractionally quicker as it saves a step. In fact. some web accelerators store thousands of popular sites in your Hosts file to take advantage of this slight increase in speed.

But there's another common usage for the Hosts file: to block addresses. This is done by using a dummy address, typically 127.0.0.1, that goes nowhere. For example, consider this entry:

127.0.0.1 wwww.yahoo.com

With this entry in the hosts file, any reference to www.yahoo.com will be redirected to the address 127.0.0.1. Now that address is not a valid web address for any real web site. In fact, by convention it refers to your own computer.

If you have this entry in your Hosts file and you type www.yahoo.com into your browser, you'll get an error message: "Host cannot be found."

This is the very technique that we can use to block Google text ads.

Stopping Google Ads with the Hosts File

All the Google text ads seem to come from the addresses pagead.googlesyndication.com or pagead2.googlesyndication.com. If we place these names in the Windows Hosts file and point them to a dummy address then the Google ads will not appear.

First though, we need to locate the hosts file. Here is the usual location for the major Windows versions:

Windows 10, 8, Vista, 2003, XP, 2K C:\Windows\system32\drivers\etc
Windows NT (and some 2K) C:\WINNT\system32\drivers\etc
Windows 9x, ME C:\WINDOWS

The Hosts file is simply called "HOSTS" and has no file extension.

It's a simple text file and must only be changed with a plain text editor like Notepad and never a word processing program such as MS Word.

First, we need to open the Hosts file in Notepad. If you don't know how to do that then locate the Hosts file in Windows Explorer and right-click on it. Select "Open" and then check "Select the program from a list." You'll then be presented with list of programs; select Notepad. You should now see a simple text file.

Go to the first blank line at the bottom of the file and copy and paste these lines into the file:

127.0.0.1 pagead.googlesyndication.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 adservices.google.com
127.0.0.1 ssl.google-analytics.com 
127.0.0.1 imageads.googleadservices.com 
127.0.0.1 imageads1.googleadservices.com
127.0.0.1 imageads2.googleadservices.com
127.0.0.1 imageads3.googleadservices.com
127.0.0.1 imageads4.googleadservices.com
127.0.0.1 imageads5.googleadservices.com
127.0.0.1 imageads6.googleadservices.com
127.0.0.1 imageads7.googleadservices.com
127.0.0.1 imageads8.googleadservices.com
127.0.0.1 imageads9.googleadservices.com
127.0.0.1 partner.googleadservices.com
 

Make sure you leave no blank lines before this entry.

Just save the file and you are finished. Saving this change may spark an alert from your anti-virus software but it's OK, just approve the change.

If you've followed the instructions carefully you should never see Google AdSense text ads again. If at a future stage you want to see the ads again, just use Notepad to delete the line you just added.

The same technique can be used to block other advertising servers, malicious spyware or sites containing inappropriate material. In fact a number of folks offer free downloads of Hosts files containing thousand of entries of such unwanted sites.

I'm not a great fan of using the Hosts file for such large scale blocking. To me it's too unselective - I prefer to know exactly what I am blocking and this is virtually impossible with a list containing thousands of sites. However if you want to play with this kind of application, here are some Host file download sites:

http://www.hosts-file.net/
http://www.mvps.org/winhelp2002/hosts.htm

Dedicated Host file enthusiasts may want to check out Hostess, a free Hosts file editor/manager you can get from here: http://www.raymarron.com/hostess/


Gizmo

Please rate this article: 

Your rating: None
4.23
Average: 4.2 (200 votes)

Comments

Thank you for the article. Really have been wanting to stop the ads. I followed the directions, but when I save the .hosts on Notepad file and request to replace the existing file I receive the message "Access is denied". That is where I get stuck.
I am working on Windows 7 and use Firefox.

Maybe this will help. Looks like Notepad needs to be run as administrator.
https://support.microsoft.com/en-us/kb/923947?wa=wsignin1.0

I have tried to block all of googles back door invaders but I can neither block this one or find any info on the web even in dogpile. "http://tpc.googlesyndication.com"

haha.. I got it working, was a typo..

32meg hosts file is too big, we are never going to come upon all the address's listed. The most important is to block all the trackers and proxy like crap like googlesyndication and static.facebook

This is a great workaround. I just tried also adding a line for Google's new search homepage ad (d.startpagea.com). Now all I get is the "Unable to connect" message which is visibly obvious but after two or three views is not distracting.

Thanks.

I suddenly started having this issue in Internet Explorer... certain websites I tried to go to would not come up and it would state, "This page can't be displayed". I thought at first it was a virus. What showed in the URL was the following:

http://pagead2.googlesyndication.com

I knew I had the problem right after I had gone to Internet Options and Manage Add-ons and messed around in there, so I tried to retrace my steps and soon I had figured it out. This is what I did to correct the problem:

-------------

Go to Internet Options---->then to Manage Add Ons-----> then to Tracking Protection--------> Now highlight "Your Personalized List"-----> click the box below in right hand corner of page that should say, "Disable"--------> Now, click the box "Close".

-------------

This took care of the problem for me.

=============================================

Btw.. I am using Windows 8.1 and Internet Explorer 11.