Remove Google and Yahoo Ads

Update 2 (2011-01-08): Updated with instructions for Chrome users.

Update 1 (2007-01-31): Included a fourth (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.

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 for Firefox or Adblock Plus for Chrome and add the following two filters:

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

and

http://pagead2.googlesyndication.com/*

Solution 2. CSS—no additional addons required

In Firefox, you can edit userContent.css (read Editing configuration if you need help). In Chrome, you’ll have to find ‘Custom.css’ (on Windows, this will be at appdata\Local\Google\Chrome\User Data\Default\User StyleSheets\Custom.css). In that file, 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 the browser (Chrome appears to apply the rules immediately as soon as you save the file).

Solution 3. Replacing Ads with Greasemonkey

In Firefox, install Greasemonkey (Chrome needs no extension) and then my Replace Google/Yahoo Ads script.

Before and after screenshot:
[2 screenshots]

Solution 4. hosts file

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. Open it with a plain-text editor, e.g. Notepad, and add the following three lines:

127.0.0.1    pagead.googlesyndication.com
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.

15 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

  11. Posted 1 June 2010 at 7:37 pm | Permalink

    I have subscribed to your feed. Thank you for sharing. It seems to work good !

  12. Posted 4 June 2010 at 7:20 pm | Permalink

    There is a new greasemonkey solution for a clean google experience. it hides all ad blocks and shopping results on google’s search result pages. that way you will only get the organic – the real results.

    more info:
    http://eyecatch-up.de/news/no-more-ads-on-google-serps.html

  13. Phoe
    Posted 16 September 2011 at 4:57 pm | Permalink

    This doesn’t work anymore. Any new ideas/

  14. Joe
    Posted 28 May 2012 at 11:36 am | Permalink

    Still can’t get rid of ads in search results. eyecatch-up.de has been taken down.

  15. Anonymous
    Posted 6 June 2012 at 7:54 am | Permalink

    Needs to be updated whenever the result page has changed.
    For Google, this currently works – hides the top and bottom ads from results:

    /*
    * Remove Google ads
    */
    div[id='tads'],
    div[id='bottomads']
    { display: none ! important; }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

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