Optimize your Adblock Plus Filter List - gHacks Tech News

Optimize your Adblock Plus Filter List

Adblock Plus is probably one of the most popular Firefox extensions of all time. It blocks almost any advertisement on the Internet and is highly effective. Users can add filters to Adblock Plus that whitelist those websites which means that ads on those websites will be shown. This is excellent for webmasters who want to make sure that their websites are displaying the correct ads and visitors who want to give something back to a website that they really like.

The filter list grows over time, I know mine does and becomes ineffective this way due to duplicate entries and ineffective usage of space in the filter list. Thankfully though the Adblock website offers a way to optimize this filter list to make it more effective. Before you can start with the optimization you need to export your current filter list.

Press CTRL + SHIFT + A to open Adblock Plus. Click on Filters > Export Filters to save the filter list as a text document. Now load the Adblock Plus optimization website and paste the contents of the saved filtered list into the form.

adblock filter optimizer

The default options that are available at the bottom should be sufficient for most users. Just make sure you check Optimize including preexisting RegExes if you already have an optimized version but added new filters to that one. Click on the optimize button which should display some stats and of course the new optimized filter list.

adblock plus optimized filter list

Now copy and paste the new filter list into a text document and import it again into Adblock Plus. Press CTRL + SHIFT + A again and click on Filters > Import Filters. Select the text document that contains the updated filter list and click ok. Make sure you select Overwrite when asked if you want to overwrite or append the filter list.

My filter list, which only contained 12 lines and 364 chars was reduced to 1 line and 251 chars which means a reduction of 91.7 % and 31 %.

Update:

Wladimir Palant from Adblock Plus contacted me and told me that Adblock Plus users should use the following two scripts if they want to optimize their filter list. You find the correct links in the article now.

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Comments

  1. Scott said on January 7, 2008 at 10:44 pm
    Reply

    Holy crap – that’s fast… Thanks, Martin!

    Optimization took:
    0.213 second

    Number of lines prior to optimization:
    64
    Number of characters prior to optimization:
    5048

    Number of lines after optimization:
    7 (89.1 % less)
    Number of characters after optimization:
    2721 (46.1 % less)

  2. Asher said on January 8, 2008 at 12:00 am
    Reply

    why optimize the list?
    does it go faster or what?

  3. Ace_NoOne said on January 8, 2008 at 12:39 am
    Reply

    It’s nice to see that your posts are not influenced by monetary considerations (seeing as you’re making a living off your blog’s ad revenues now… ).

  4. Stefan said on January 8, 2008 at 12:39 am
    Reply

    Since my list consists only of 3 lines, optimization is not a big deal for me.

    But I wonder: Even though I deactivated Adblock Plus on my blogs, Firefox doesn’t display Google AdSense text ads. I’d like to see which ads are placed on my blog but I have to open it with Internet Explorer or any other browser to check my Google AdSense text ads. Any ideas?

  5. Martin said on January 8, 2008 at 12:51 am
    Reply

    Asher: The optimizer gets rid of duplicate entries among other things. I do not think that you will notice a speed difference unless you have lots of sites in that filter.

    Ace: Yes that’s something I pondered with for a while.

    Stefan that’s strange. Maybe another add-on, deactivated Javascript or security program that is interfering ?

  6. Asher said on January 8, 2008 at 1:23 am
    Reply

    @Stefan: I know the Customize Google extension gets rid of those but i am positive you can turn it off. Just something to check on

    @Martin: I just don’t see a point to optimizing. I mean, why does how big your filter list is matter?

  7. Enigma said on January 8, 2008 at 1:45 am
    Reply

    Optimization took: 0.257 second

    Number of lines prior to optimization: 87
    Number of characters prior to optimization: 4512

    Number of lines after optimization: 7 (92 % less)
    Number of characters after optimization: 2649 (41.3 % less)

    I think it speaks for it’s self lol

  8. Stefan said on January 8, 2008 at 1:50 am
    Reply

    Look at my screenshot: No Google Adsense text ads with Firefox. NoScript and Adblock Plus are deactivated. No other interfering Add-ons installed. Very strange…

    http://www.alterfalter.de/adsense.jpg

  9. Stefan said on January 8, 2008 at 2:20 am
    Reply

    @Asher: Sorry, I forgot to check “Customize Google extension”. Is this something inside Firefox? Or another Add-on?

    Edit: Found it. “CustomizeGoogle is a Firefox extension that enhances Google search results by adding extra information (like links to Yahoo, Ask.com, MSN etc) and removing unwanted information (like ads and spam).”

    But nope, I haven’t installed that.

  10. Marc-O said on January 8, 2008 at 7:48 pm
    Reply

    I’m also curious about what it really changes. I’m sure the few bytes you save this way are precious, but how does AdBlock itself react to the optimized list – is he any faster with regular expressions than with a regular blacklist?

    The real effect I see though, is that it removes all simplicity from the filter list, and replaces it with the obscure cleverness of a regular expression… Is that a worthy trade-off? A simple understandable (and big) blacklist for a glorious ball of regexp spaghetti!

    I’ll probably never trade the kilobyte of memory this plugin would save me for the simplicity of the complete list, but it’s still a pretty fun tool for the fans of regexp arcanum.

  11. Bambo said on January 8, 2008 at 9:43 pm
    Reply

    I think you have missed one of the great advantages of Adblock Plus. It does own optimizations = lets users work with manageable lists. 2 mile long lists dont make it any slower. Check Adblock Plus site for more – think author even have done some benchmarking proving this point. In the FAQ as well http://adblockplus.org/en/faq_internal#filters

  12. Bernt said on March 24, 2009 at 6:46 pm
    Reply

    Nice!

  13. Richard (aka Tek'eek) said on April 18, 2011 at 5:02 pm
    Reply

    First, thanks for the all-in-one site.

    However, after reading this article and the update to it, it left me hanging on which to use first. Upon reading each site I discovered that “Translate regular expression” has on there site to follow with “Find useless filters”.

    So the following list in order is with which optimizing should take place:
    1. “Translate regular expression” http://adblockplus.org/en/deregifier
    2. “Find useless filters” http://adblockplus.org/en/redundancy_check
    3. “Adblock list optimizer” http://adblock.free.fr/optimize/index.php

  14. Richard (aka Tek'eek) said on April 18, 2011 at 5:34 pm
    Reply

    I believe the Adblock list Optimizer is no longer valid. After running it through the list and importing it Adblock Plus listed it as slow filters

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.