Ash Clarke

Software Engineer. User Interface Developer. Gamer. Nerd.

How to Hide Facebook Ads in Mozilla Firefox with Stylish

Ads. They suck. You never click them and they don’t benefit your life whatsoever.

If this sounds like you, I will now let you in to a secret way of hiding them that no company ever wants you to find out…

Not really, it’s just CSS styles. First step is to download the Stylish add-on for Mozilla Firefox.

After you have installed the add-on and restarted Firefox, visit Facebook.com.

In the bottom right corner of Firefox, there will be an S icon.

Clicking this will open up a menu, where you can choose to “Write a New Style”. Click the “For facebook.com” option.

This will bring up a new window where you can enter your new styles to override the Facebook developers’ defaults. I have added a screenshot to show where the new styles go.

Now you can replace the text in the window with the following rules:

@-moz-document domain("facebook.com") {
/* Updated 16-09-2012 */
/* Hide ads on Home */
#rightCol #pagelet_ego_pane_w,
#pagelet_ads_when_no_friend_list_suggestion { display: none; }
/* Hide Right Column Footer on Home */
#rightCol #pagelet_rhc_footer { display: none; }
/* Hide ads on Timeline and Photo View */
.fbTimelineSideAds,
#rightCol #pagelet_side_ads,
#fbPhotoSnowliftAdsSide,
div[class*=snowliftAds],
.ego_section[data-adblock-hash],
._24q .ego_column:not(.egoOrganicColumn) { display: none; } /* Hide ads on Friend's Profiles */ #rightCol #pagelet_ego_pane .ego_column:not(.egoOrganicColumn), [data-referrer*=pagelet_side_ads] { display: none; } /* Hide ads on Comment View */ .UIStandardFrame_SidebarAds #pagelet_ego_pane .ego_column:not(.egoOrganicColumn) { display: none; } /* Hide "People you may know" on Comment View */ .UIStandardFrame_SidebarAds #pagelet_ego_pane .egoOrganicColumn { display: none; } /* Hide ads and sponsored stories on Message View */ #MessagingNetegoSidebar #pagelet_ego_pane .ego_column:not(.egoOrganicColumn), #MessagingNetegoSidebar .ego_column:not(.egoOrganicColumn) { display: none; } /* Hide ads on Lists */ #pagelet_ads_when_no_friend_list_suggestions .ego_column:not(.egoOrganicColumn) { display: none; } }

Click the “Preview” button and you should see the ads disappear in the background. Click “Save” and the window will close. The styles will now be loaded when you visit any part of Facebook.

Let me know if this doesn’t work, or stops working. The styles above are heavily dependent on how Facebook developers have named the Ad elements on the site.

If they, therefore, realise another lovely update the ads might suddenly reappear and I will have to spend another 30 seconds writing a new style and 10 seconds updating this post : )

If you feel you can’t trust this, or it looks like something messed up, you can find the “Uninstall” (to remove it) or “Disable” option by right-clicking on the style when visiting Facebook.

UPDATE [06/09/12]: Updated to hide another case of ads on photo viewer.

UPDATE [06/09/12]: Updated to hide more ads on news feed page and friends’ timelines.

UPDATE [26/08/12]: Updated to hide more ads on photo view page.

UPDATE [30/07/12]: Updated to hide ads on message view page.

UPDATE [30/06/12]: Updated to hide ads on lists.

UPDATE [03/06/12]: Updated to hide ads on friend’s profiles.

UPDATE: Added styles to hide new ads on the new timeline profile.

UPDATE [02/11/11]: Updated with new css to reflect recent code changes by FB devs.  Thanks, “R Preston Berrett”.

UPDATE [02/12/11]: Updated with new css to reflect changes to the FB site. Added better comments to explain what each bit is doing.

UPDATE [02/12/11]: Updated with new css to hide ads on “pages”. Thanks “J Greener”.

Author: Ash Clarke

I am a user interface developer based in central Reading.