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:*


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
{ display: none ! important; }

 * Remove Yahoo ads
{ 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:

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. Both comments and trackbacks are currently closed.


  1. matto says:

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

  2. Anonymous says:

    i edited the hosts file but i still see google ads

  3. Keyvan says:

    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. If you’re still having problems, let me know which browser you’re using.

  4. sick_of_google_ads says:

    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. Simone F says:

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

  6. Sis says:

    Thanks , I tried css solution and it works.

  7. claudia says:

    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. Keyvan says:

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

    Claudia: Which browser are you using?

  9. snjblack says:

    Use a white background to the replaced Ad area !

  10. Melissa says:

    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.

  11. Thibault says:

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

  12. steve says:

    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:

  13. Phoe says:

    This doesn’t work anymore. Any new ideas/

  14. Joe says:

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

  15. Anonymous says:

    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
    { display: none ! important; }