How Ad Blockers Actually Work


About 40% of internet users now run some form of ad blocker. Most install one, notice the ads disappear, and never think about it again. But understanding how ad blockers actually function — the technical mechanisms, the filter lists, the arms race with advertisers — is worth knowing, partly because it makes you a more informed internet user and partly because it helps you choose the right blocker for your needs.

The Two Main Approaches

Ad blockers broadly use two techniques: network-level blocking and cosmetic filtering. Most modern blockers use both.

Network-level blocking prevents ad content from being downloaded at all. When your browser requests a webpage, it also makes dozens of additional requests for resources — images, scripts, stylesheets, fonts, and tracking pixels. Many of these requests go to ad-serving domains like doubleclick.net, googlesyndication.com, or facebook.com/tr. A network-level blocker intercepts these requests and blocks them before any data transfers.

This is efficient because blocked content never reaches your browser. Your page loads faster (sometimes dramatically — ad-heavy pages can make 100+ additional network requests), you use less bandwidth, and your browser consumes less memory. It’s also relatively hard for websites to detect, because from the site’s perspective, the request simply failed — which could be a network issue, not necessarily a blocker.

Cosmetic filtering hides ad elements after the page has loaded. Even when network-level blocking stops the ad content, the page’s HTML often still contains placeholder elements (empty <div> tags, iframes) that leave visible gaps where ads should appear. Cosmetic filters identify these elements using CSS selectors and hide them, making the page look clean rather than full of blank spaces.

Cosmetic filtering is also used when network-level blocking isn’t possible — for example, when ads are served from the same domain as the content (first-party ads) and blocking the domain would break the page. The filter can hide the specific ad element without blocking the entire domain.

Filter Lists: The Brain of the Blocker

Ad blockers don’t individually identify every ad on the internet. They rely on filter lists — community-maintained databases of rules that specify what to block. The most important filter list is EasyList, which has been maintained since 2005 and contains tens of thousands of rules covering ad-serving domains, ad-related URL patterns, and cosmetic selectors for hiding ad elements.

Other notable filter lists include:

  • EasyPrivacy — blocks tracking scripts and analytics
  • Fanboy’s Annoyances — blocks cookie consent popups, social media widgets, and newsletter overlays
  • uBlock filters — additional rules maintained by the uBlock Origin team
  • Regional lists — country-specific rules for local ad networks

Most ad blockers subscribe to multiple filter lists by default. uBlock Origin, for instance, enables EasyList, EasyPrivacy, and several others out of the box. Users can add additional lists based on their preferences.

The filter list model has strengths and limitations. Strengths: it’s crowd-sourced, regularly updated (EasyList updates multiple times daily), and covers the vast majority of mainstream ads. Limitations: it’s reactive — someone needs to identify and report a new ad format before a filter rule can be written. There’s always a window between a new ad technique appearing and a filter being created to block it.

DNS-Level Blocking

A different approach to ad blocking operates at the DNS level. Every time your browser loads a page, it needs to resolve domain names (like ads.example.com) into IP addresses through DNS lookups. DNS-level blockers intercept these lookups and return null responses for known ad-serving domains, preventing the connection entirely.

Pi-hole is the most well-known DNS-level blocker. It runs on a Raspberry Pi (or any Linux device) on your local network and acts as your network’s DNS server. Every device on the network — phones, tablets, laptops, smart TVs — gets ad blocking without installing anything on the devices themselves.

The advantage of DNS blocking is coverage: it works across all devices and all apps, not just web browsers. In-app ads, smart TV ads, and IoT device telemetry can all be blocked. The disadvantage is less precision — you can only block or allow entire domains, not specific URLs or page elements. Some domains serve both ads and legitimate content, and blocking them breaks functionality.

AdGuard DNS and NextDNS offer cloud-based DNS blocking without requiring hardware setup. You change your device’s DNS settings to point to their servers, and they handle the filtering. It’s simpler than running Pi-hole but involves trusting a third party with your DNS queries — which is exactly the kind of data that privacy-conscious people want to control.

The Arms Race

Websites don’t passively accept ad blocking. Many actively try to detect and circumvent blockers. Common techniques include:

Anti-adblock scripts that detect when ad elements fail to load and display messages asking users to disable their blocker. Some sites refuse to show content until the blocker is turned off. These scripts check for the presence of known ad elements — if the element is missing, they infer a blocker is active.

Server-side ad injection serves ads as part of the main page content rather than from separate ad domains. Because the ads come from the same domain as the content, network-level blocking can’t distinguish them. YouTube has been particularly aggressive with this approach, integrating ads into the video stream itself rather than loading them as separate resources.

Randomized class names and IDs change the CSS identifiers of ad elements randomly, making cosmetic filter rules that target specific class names ineffective. Each page load generates different element names, forcing blockers to use more sophisticated pattern matching.

Ad blocker developers respond with counter-techniques: anti-anti-adblock scripts that neutralize detection, machine learning approaches that identify ads by their visual characteristics rather than their code, and community reporting systems that quickly add new circumvention techniques to filter lists.

It’s genuinely an arms race, and neither side is winning decisively. The result is that ad blocking works most of the time but not all of the time, and the experience varies by website.

Which Blocker to Use

uBlock Origin is the clear recommendation for most people. It’s open source, lightweight, effective, and free. It uses filter lists for both network and cosmetic blocking, offers granular control for advanced users, and is maintained by a dedicated developer (Raymond Hill). Available for Firefox, Chrome, and Edge. Note that Google’s Manifest V3 changes have limited uBlock Origin’s capabilities on Chrome — Firefox is now the better platform for ad blocking.

AdGuard offers both browser extensions and system-wide ad blocking (as a desktop/mobile app). The system-wide blocking catches ads in apps, not just browsers. The browser extension is free; the system-wide apps require a paid subscription.

Pi-hole for network-wide DNS blocking, if you’re comfortable with basic Linux administration and have a spare Raspberry Pi or server.

Brave browser has ad blocking built in, which is convenient if you’re willing to switch browsers. The blocking is competent though less configurable than uBlock Origin.

The Ethical Question

Ad blocking raises legitimate ethical questions. Many websites depend on ad revenue to fund their content. If everyone blocked ads, many free websites would cease to exist or move behind paywalls. Blocking ads while consuming content is, in some sense, taking something without paying for it.

On the other hand, the ad industry has thoroughly earned users’ distrust. Intrusive formats, malware distribution through ad networks (malvertising), pervasive tracking, and performance degradation have pushed people toward blocking as a form of self-defense. The blame for widespread ad blocking lies at least as much with the advertising industry’s excesses as with users’ unwillingness to tolerate them.

There’s no clean answer here. Some people whitelist sites they want to support. Some donate directly to creators. Some accept that the current advertising model is broken and feel no obligation to participate in it. Where you land depends on your values and how much you trust the ad ecosystem to respect your attention and your data.