UBlock Origin and custom filters - Mini tutorial

Updated: January 18, 2021

Several months ago, I wrote a review of UBlock Origin. It's a powerful, nerdy browser extension, available across the wider range of browsers out there, with the sacred purpose of making the Internet palatable for intelligent use. It does so by being a sophisticated adblocker and content blocker.

Since, I've received requests for additional tutorials - and also found myself tackling a few real-world issues with somewhat overzealous content blocking. For example, on Bing images, if I clicked on an image, they would show up for a second, flicker and then disappear. Not consistently - but always with UBlock Origin active. So I used this opportunity to write a little guide on how to create custom filters. Let's have a look.

Our example - Bing images

So yes. Bing, images, click to see, flicker, gone. What you want to do is, click the UBlock Origin icon, and then click on the Logger button. This will open a separate window, which will list every single query, including both allowed and blocked ones. Thus, you can repeat whatever you're doing, and see exactly why the content is not showing.


The logger is powerful - and detailed. But you can do a whole lot with it - most importantly, it allows you to make live changes, including adding and removing static rules. More on that later. Since the information shown in the logger can be overwhelming, you can filter the displayed content (inside the logger, that is). For example, you could only look at blocked images.

Each session will be shown under a separate heading - and then, you can click on any which individual line to see exactly what was done and why. You can see the details, the rule, and then the static filter as a result of the rule. And then, you can change it!


Custom rules on the fly

Like everything UBlock Origin, you have tons of flexibility in how you customize rules and filters. In our example, we can either allow or block network requests. Then, we can specify the type we like - images in this case. The address can be a very specific domain - but this is not necessarily useful, because if you resolve to a slightly different address, the rule won't apply. So you could use a4.bing.com, or www.bing.com or just bing.com as the most inclusive qualifier. Similarly, you can specify the hierarchy of the URL.

Then, there's the originates from - because sometimes the content may not organically belong on the domain, and you could be loading content (images) from a different domain. The same results for domain matching apply here. You can be as precise or as inclusive as you like to, with the understanding your strictness or laxness will affect the effectiveness of UBlock Origin.

Custom rule

You can then specify if you want the static filter to apply even if there's an existing exception. While you do this, interactively, you will see the exact filter listed in the box below. If you apply the filter, then it will be added to My Filters. Something like:


My filters

An example of possible rule(s) - it's entirely up to you to decide what you want to allow or block.

Filters versus rules?

Now, instead of making a specific filter, you could create a rule. The difference is - rules are dynamic, filters are static. In other words, rules work by allowing or blocking certain Web page/script behavior logic, whereas filters are simply what their names implies - a net to catch or pass through specific elements on specific pages.

There's much, much more to it, and I wouldn't presume to make this short tutorial into any sort of comprehensive guide on UBlock Origin. That could perhaps be a separate article. For now, the focus was just to show you a simple, convenient and powerful way to create your own custom filters on the fly, so you have a more refined Web experience.


Here we go. The Internet is a weird jungle, and most of it hostile to the unwary wanderer. The existence of content filters like UBlock Origin makes the Web actually usable. But then, sometimes, the complex matrix of its rules and filters can render legit content unusable. In such situations, you may need to troubleshoot.

Luckily, the built-in logging facility in this extension is extremely useful - precise and friendly, and the drop-down wizard lets you create filters easily. That does not mean you will be able to solve every single problem instantly, but it will also stop you from disabling UBlock Origin completely if and when something goes wrong. Well, hopefully, this was useful. Have fun, and may your Internets be pure.