Skip to content
Know.itKnow.it
Create an animated lesson
On request

This article is free to read. Creating a lesson uses your daily or stored credits; review the language and settings before starting.

How does an ad blocker work?

TechnologyLesson on requestFree to read

Quick answer

An ad blocker is software that checks every resource your browser tries to load against a filter list of known ad servers and URL patterns. Requests that match are blocked before they are sent, and ads already in the page are hidden with CSS, so they never appear.

An ad blocker works by intercepting network requests that browsers make for advertising content and blocking those that match known ad-serving patterns. It relies on filter lists that map domains, URLs and element signatures to rules, so ads never load or render.

Step by step

  1. The browser starts loading a webpage and discovers resources to fetch, including scripts, images and iframes.
  2. The ad blocker examines each request's URL and domain against its filter lists of known ad sources.
  3. If a request matches a blocking rule, the blocker cancels it so the ad content is never downloaded.
  4. For ads written directly into the page's HTML, the blocker applies CSS rules to hide those elements.
  5. The page finishes rendering without the blocked ads, and the filter lists update periodically to catch new ad servers.

Key things to understand

  1. When a page loads, the browser requests resources such as images, scripts and iframes from many servers.
  2. An ad blocker inspects each outgoing request against a filter list of known ad domains and URL patterns.
  3. Requests that match a blocking rule are stopped before they leave the browser, so the ad never arrives.
  4. For ads embedded directly in a page's HTML, the blocker hides the element using CSS rules after parsing.
  5. Filter lists are maintained by communities and updated regularly to keep pace with new ad servers.

Labelled diagram

  1. Page load

    Browser begins fetching HTML and discovers external resources like scripts and images.

  2. Request check

    Ad blocker compares each resource URL against filter lists of known ad domains.

  3. Block or allow

    Matching requests are cancelled; non-matching requests proceed to the network.

  4. Hide in-page ads

    CSS rules hide ad elements that are part of the page's own HTML.

  5. Render page

    The page displays without the blocked advertising content.

How an ad blocker stops an ad

Real-world examples

  • On a news website, a banner ad loaded from a third-party ad network is blocked because its domain appears in a filter list.
  • A video platform's pre-roll ad, served from a separate ad server, is stopped before the video player can request it.
  • A pop-up window that would open from an ad script is prevented because the script itself is never loaded.
  • A sponsored post that is part of the page's own HTML may still appear unless the filter list includes a rule for that specific element.

Common mistake

✗ Myth: Ad blockers delete ads after they have already loaded on the page.

✓ Fact: Most ad blockers prevent ad requests from being sent in the first place, so the ad content is never downloaded. Only ads embedded directly in the page's HTML are hidden after loading, using CSS.

People also ask

How does an ad blocker know what to block?
Ad blockers rely on filter lists, which are large text files of rules listing known ad-server domains, URL patterns and element identifiers. These lists are compiled by communities and updated regularly. When a request matches a rule, it is blocked; if no rule matches, the request proceeds normally.
Do ad blockers work on all websites?
They work on most websites that load ads from third-party ad networks, because those requests can be identified and blocked. However, ads served from the same domain as the site, or inserted directly into the page's HTML, may still appear unless the filter list has a specific rule for them.
Can I get in trouble for using an ad blocker?
Using an ad blocker on your own device is generally legal in most countries, as you control what your browser displays. Some websites may ask you to disable it or block access if they detect it, and their terms of service might prohibit it, but legal consequences for individual users are rare.
Does an ad blocker slow down my browser?
Usually no; it often speeds up page loads because fewer network requests and scripts are downloaded. The small overhead of checking each request against filter lists is typically outweighed by the resources saved.
Can websites detect that I am using an ad blocker?
Yes. A site can run a script that tries to load a small test ad or checks whether an ad element has been hidden, and if the test fails it may show a message asking you to disable the blocker.
Do ad blockers stop all ads?
No. Ads served from the same domain as the page content, or inserted directly into the page's HTML without a separate request, can slip through unless the filter list includes a specific rule for them.
Are ad blockers legal?
In most countries, using an ad blocker on your own device is legal because you control what your browser displays. Laws vary, and some sites argue that blocking ads violates their terms of service.

Part of the guide: How the Internet Works →