How to block Youtube ads?

Pi-hole is up and running. But is there is trick to block Youtube ads? Must be possible...!
Thanks in advance.

Not with Pi-hole (at least not reliably). YT serves the ads from the domains as the content. If you block the ad domains, you will interfere with content.

Reliable methods to block YT ads include:

  1. Watch YT on a browser with an ad blocker such as uBlock Origin installed. This style blocker inspects content at the element level and has more success with YT ads.

  2. Subscribe to YT Premium and see no ads on any platforms that you use to watch YT.


I installed eBlocker on my Raspberry over the weekend and it blocks YouTube like a charm. Don't know why this is so complicated / impossible with Pi-hole. Thanks anyway for your quick reply.

Pi-hole and eBlocker are two completely different products.

As already explained, Pi-hole is a filtering DNS resolver.
Pi-hole sees and filters only the DNS traffic in your whole network.
As DNS traffic takes only a fraction of the available bandwidth, Pi-hole runs adequately even on tiny hardware with relatively low-bandwidth network connections.

eBlocker, on the other hand, is a packet filter (like you find in a firewall on a computer), plus a fake HTTPS certificate and some other extras.
This is a solid and somewhat broader approach, but it is not a silver bullet either.


For such a service to be able to filter your entire home network, the entire network traffic has to go through the eBlocker machine first instead of through the router.

A packet filter can then not only analyse domains, but also source and destination addresses as well as packet contents (DPI, deep packet inspection) and therefore also apply filter parameters that are not contained in the DNS data stream at all.

On the other hand, this takes up considerably more bandwidth and CPU (which also increases power consumption).
Accordingly, the hardware on which eBlocker runs should be more powerful, with a higher bandwidth network connection, preferably dual ports.

Furthermore, filtering by packet content basically only works if the data traffic between client (e.g. PC) and server (e.g. YouTube) is unencrypted, e.g. via HTTP.

If encrypted HTTPS pages should also be filtered, eBlocker has to forge a corresponding certificate. Additionally, that certificate has to be installed on every client for which HTTPS filtering is desired.

And of course, this only works if such a certificate can be installed on the end device to be filtered (which is not possible e.g. for TVs, network speakers, or many IoTs), and also only as long as the original destination server does not use certificate validation techniques.

As techniques (such as certificate pinning) become more common, HTTPS access with fake certificates will work less and less often.

Since encrypted packet contents would be no longer accessible without the possibility to forge a certificate, the level of protection for HTTPS connections would fall back to domain filtering and IP filtering - i.e. to about the same level as the combination of Pi-hole and router firewall (notwithstanding the other extras mentioned previously).
This is also the reason some of my friends have returned to Pi-hole shortly after trying eBlocker.

Depending on your personal preference and available hardware, the additional features (e.g. Tor gateway) may still make eBlocker's use appealing (although some of those could also be implemented with Pi-hole in combination with appropriate software).

But, as long as it works for you for your Youtube problem, stick with it. :wink:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.