How ad-blockers actually work, and why they don't speed up the page
I thought ad-blockers stopped ads from downloading. Turns out half the time, they don't. The download already happened. The block is what you see.
Mind blown moment. I was digging into how ad-blockers actually pull off the YouTube-ads thing. It's kinda simpler than I thought, and the surprising part isn't the blocking itself. It's where in the request lifecycle the blocking happens.
The naive model in my head
When you hit a page, your browser doesn't just grab the article. It grabs everything in one go. HTML, CSS, fonts, scripts, images, and yup, the ads. They all arrive together. The ad-blocker, I assumed, was like a bouncer at the door. Sees the ads coming in, turns them away. Easy.
That's about half right.
What's actually happening
Modern ad-blockers do two completely different things, often at the same time.
1. Request blocking (the bouncer)
This is what I had pictured. The extension hooks into Chrome's webRequest API and watches every outgoing call. If the URL matches a known ad-network pattern (think doubleclick.net, googlesyndication.com), the request never goes out. Bytes saved. Time saved.
# example uBlock network filters
||googlesyndication.com^
||doubleclick.net^
||google-analytics.com/analytics.js2. Cosmetic filtering (the curtain)
This is the part that surprised me. When ad content arrives bundled with the page itself (a static element inside the article HTML, an inline image, a self-hosted sponsor banner), the browser has already downloaded it. The blocker can't undo the download. What it CAN do is hide the element from rendering.
# example uBlock cosmetic filters
##.ad-banner
##div[id^="ad-slot-"]
##.sponsored-contentThese get injected as a stylesheet that sets display: none on matching nodes. The ad data was on your computer the whole time, just never painted to the screen.
Does this actually make pages faster?
Yes, but not for the reason you'd guess. The request-blocking half saves you the download AND the JavaScript execution that the ad script would have triggered. That's usually the bigger win. Most ad scripts do a stupid amount of post-load work: fingerprinting, analytics, more network calls. Killing them early matters.
The cosmetic-only half saves you basically just layout and paint cost for the hidden elements. Helpful, but a smaller win.
The CDN realization
Here's the bit that broke my brain. Ads are usually served from hyper-efficient CDNs, separate from the main site's servers. So even when ads aren't blocked, the main site isn't doing the heavy lifting. The article you're reading and the ad network sharing the page have completely independent infrastructure.
Wild
All of this is happening in the milliseconds between you clicking a link and the page actually appearing. Filter list lookups, request interception, cosmetic injection, render passes. Your browser is doing a stupid amount of work to give you the version of the page you wanted instead of the one the publisher sent.
Worth respecting how good ad-blockers have gotten at making it feel like it's just not there.