Remove Google and Yahoo Ads

Update (2007-01-31): Included a fourth (Windows hosts) method for getting rid of ads.

More and more sites are displaying Google (AdSense) or Yahoo (YPN) ads. I thought I’d post up 4 simple ways you can get rid of these ads, and, if like me, you’d still like to know which sites use them but don’t really want to see the ads, there’s even a solution to replace them with boxes. Solutions 1-3 require Firefox. Solution 4 should work with any browser on a Windows system.

Note: these solutions are targeted at Google and Yahoo ad services, to remove other ads you can follow the steps in my ad-free browsing guide. Solutions 1, 2 and 4 only remove the ads, solution 3 also replaces them with boxes where the ads would have appeared.

Solution 1. AdBlock Plus extension

Install Adblock Plus and add the following two filters:

http://ypn-js.overture.com/*

and

http://pagead2.googlesyndication.com/*

If you’re already running AdBlock Plus, you can subscribe to my Google and Yahoo ad remover filter set.

Solution 2. CSS—no additional addons required

Edit userContent.css (read Editing configuration if you need help) and add the following two rules:

/*
 * Remove Google ads
 */
iframe[name='google_ads_frame'],
a[href^='http://pagead2.googlesyndication.com']
{ display: none ! important; }

/*
 * Remove Yahoo ads
 */
iframe[src^='http://ypn-js.overture.com']
{ display: none ! important; }

Save and restart Firefox.

Solution 3. Replacing Ads with Greasemonkey

Install Greasemonkey and then my Replace Google/Yahoo Ads script.

Before and after screenshot:
[2 screenshots]

Solution 4. Windows hosts

This is based on Tech Support Alert’s in-depth guide to Removing Google Ads Using the Windows Hosts File. Read that if you’re unfamiliar with the Windows Hosts file.

Locate the hosts file. It’ll be found in one of these locations, depending on your version of Windows:

Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows 2K/NT = C:\WINNT\SYSTEM32\DRIVERS\ETC
Windows 98/ME = C:\WINDOWS

Open it with a plain-text editor, e.g. Notepad, and add the following two lines:

127.0.0.1    pagead2.googlesyndication.com
127.0.0.1    ypn-js.overture.com

Any feedback appreciated.

Ads on Google and Yahoo websites

The solutions above will not block ads appearing on Google or Yahoo’s own websites, e.g. Gmail or Yahoo Mail, as most of those ads are fetched server-side and not through the HTML snippets most webmasters receive when signing up to AdSense/YPN. You will however find Firefox extensions and Greasemonkey scripts targeting those sites specifically. For example, the excellent OptimizeGoogle extension removes ads from Google search results, GMail, and more.

This entry was posted in General. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

10 Comments

  1. Posted 2 May 2007 at 1:58 pm | Permalink

    Nice and easy solutions, specially the one with the hosts.conf file.

  2. Anonymous
    Posted 29 June 2007 at 6:35 am | Permalink

    i edited the hosts file but i still see google ads

  3. Posted 29 June 2007 at 1:25 pm | Permalink

    Anonymous: These methods will only remove Google Adsense ads used by webmasters on their own sites. They won’t remove Google ads found on Google’s own sites (e.g. GMail – you’ll have to use the CustomizeGoogle extension for that).

    If it is the adsense ads you’re trying to remove, make sure you edit the hosts file as described, save it, restart your browser and clear the browser’s cache. Then try loading a page with Adsense ads, e.g. adsenseguide.info. If you’re still having problems, let me know which browser you’re using.

  4. sick_of_google_ads
    Posted 20 October 2007 at 1:33 am | Permalink

    Thanks!!!! it was very helpful….I’m sending this to all my friends who are also sick of seeing these google ads EVERYWHERE…thanks again

  5. Posted 23 November 2007 at 1:57 pm | Permalink

    It is great tricks indeed, Thank you a lot for this Keyvan!

  6. Sis
    Posted 7 February 2008 at 9:50 am | Permalink

    Thanks , I tried css solution and it works.

  7. claudia
    Posted 18 April 2008 at 6:50 pm | Permalink

    I edited the hosts file and even though I don´t see the ads themselves I still have this vertical strip that says “page not found”. It´s really annoying cause its practically in the middle of the page i´m trying to see. Anyway to get rid of that, too???

  8. Posted 22 April 2008 at 10:25 am | Permalink

    Thanks for the comments – I’m glad these are working for most of you. :)

    Claudia: Which browser are you using?

  9. snjblack
    Posted 31 January 2009 at 11:17 pm | Permalink

    Use a white background to the replaced Ad area !

  10. Melissa
    Posted 21 April 2009 at 3:10 pm | Permalink

    Thanks bunches for this. I’ve been having horrendous problems the last few weeks with trying to get some sites to load. What a pain!
    The adblocker add-on for firefox worked great though.
    :D

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting