A Comprehensive Guide to Blocking Online Advertisements

Internet Security

Explore advanced techniques for effectively blocking online ads across browsers and mobile devices. This guide covers browser extensions, DNS filtering, VPN routing, and other tools to enhance your digital experience.

Disclaimer: Ads often support content creators and free online services. If you value specific creators or platforms, consider supporting them directly through memberships or donations rather than relying solely on ad blocking.

The Quest to Eliminate Online Ads

A few years ago, I decided to take comprehensive action against online advertisements. My goal was not just to block occasional banners or pre-roll videos, but to eliminate virtually all ads across my digital experience. This journey involved extensive experimentation with both common and unconventional methods. After considerable effort and observation, I've established a robust system that delivers a largely ad-free environment.

This guide details the techniques and tools I've successfully implemented, ranging from widely used solutions to more advanced, lesser-known approaches.

Tools and Techniques for Ad Blocking

We'll start with fundamental methods and progress to more sophisticated strategies. The initial suggestions are straightforward and commonly adopted, while later ones require more setup but can block ads where traditional methods often fail.

Browser Extensions

Browser-based ad blockers represent a significant user-driven movement against online advertising. You likely already use one.

I recommend uBlock Origin with Firefox; it's an exceptionally effective combination. Users of Chromium-based browsers face more challenges since Google's transition to Manifest V3 limits the capabilities of ad blockers.

My filter lists are kept minimal, covering most essential blocking needs:

  • Built-in uBlock filters
  • EasyList
  • AdGuard - Ads

Additionally, I maintain my own custom filters primarily for removing site annoyances rather than ads.

Writing Custom Filters

If you're frequently bothered by persistent elements like sticky headers or newsletter pop-ups on sites you visit regularly, you can write custom filters to remove them.

uBlock Origin provides excellent documentation about filters. Start by using the element picker (right-click an element) to observe how filters are generated. This will quickly help you understand patterns for simple removals. For complex scenarios, uBlock Origin also offers advanced scriptlet resources to target specific JavaScript behaviors. For validating filter syntax, consider using aglint, a static analyzer.

DNS Filtering

DNS filtering complements browser extensions by intercepting ads that might otherwise slip through, especially within mobile applications. Mobile apps typically fetch ads from dedicated ad-serving domains, making them readily blockable at the DNS level.

Pi-hole and AdGuard Home are popular self-hosted DNS blocking solutions. For a cloud-based alternative, NextDNS comes highly recommended, though I haven't personally used it.

I use Pi-hole, which has proven very reliable. I don't expose it publicly; instead, I route traffic through WireGuard and configure Pi-hole as the DNS server within my WireGuard setup. For blocklists, The Firebog is an excellent resource. Remember to maintain an allowlist, as some legitimate domains might occasionally be caught by aggressive blocklists, leading to broken website or app functionality.

Pi-hole can be installed in various ways; running it within Docker is my preferred and recommended method.

VPN via Cloud Provider

This method serves as a unique "secret ingredient." By routing all your internet traffic through a popular cloud provider via a VPN or proxy, many online platforms become less likely to serve you ads.

This occurs because, to these platforms, your traffic might resemble fraudulent activity. Ad platforms actively combat fraud (e.g., competitors wasting ad budgets on fake interactions). A common first step in their anti-fraud measures is to avoid serving ads to traffic originating from known public cloud provider IP addresses.

A potential drawback is that this approach can negatively impact your experience on certain websites, leading to Cloudflare captchas or HTTP errors as sites block cloud provider IPs. I find this acceptable and temporarily disable the VPN when issues arise. Be aware that even a few requests from your real IP might be sufficient for platforms to resume showing you ads.

I host WireGuard on an affordable DigitalOcean droplet, but other providers like Hetzner, Azure, Google Cloud, and AWS work equally well. DigitalOcean also offers a detailed guide on setting up WireGuard.

Other Useful Tools

Beyond direct ad blocking, several tools enhance the overall browsing experience:

  • Browser extensions for annoyances:
    • Cookie pop-ups: Consent-O-Matic
    • Captchas: Buster
  • SponsorBlock is highly recommended for skipping sponsored segments, intros, and outros in YouTube videos, saving significant time. There's also an option available for TVs and streaming devices.
  • On iOS, consider disabling Background App Refresh. While designed for specific app functions, many apps abuse it to collect more data. Without an always-on VPN, this risks exposing your real IP.
  • Patched apps offer ad-free experiences, and tools like ReVanced allow you to patch mobile apps yourself. While a decent option, it carries security risks; use with caution, especially with sensitive accounts.

Personal Experience and Effectiveness

I've been using this combination of techniques for over three years, and I now encounter ads very rarely. For those curious about specific platform effectiveness:

PlatformWeb (Browser)Mobile (iOS / Android)
YouTubeuBlock OriginNewPipe or Invidious
InstagramuBlock OriginVPN via cloud (takes 1 week - 1 month)
TwitchVPN via cloud (takes a few days)-
TikTokuBlock OriginVPN via cloud (takes a few hours)
Apps with AdMob-DNS blocking

These listed scenarios highlight the trickier outliers. For most websites and apps, a combination of DNS filtering and a browser ad blocker typically catches 99% of ads without extra effort. The VPN approach addresses the remaining 1%, though it often requires time to become fully effective. Platforms don't make decisions based on a single IP observation; they require patterns observed over days or weeks.