CLI tool to separate network blocking from browser blocking (CSS, JS, HTML).
Result is sorted and deduplicated.
adblockptimize <FILES or URLs> # split in 2 files: network_blocking.txt (domain format by default) and browser_blocking.txt adblockptimize --no-browser --format=dnsmasq <FILES or URLs> adblockptimize --no-network <FILES or URLs> adblockptimize --network-file=custom.txt --browser-file=ublock_origin.txt <FILES or URLs>
| Software | Domain Blocking | Wildcard Blocking | Regex Support | Whitelisting |
|---|---|---|---|---|
| Pi-hole | ✅ Yes | ✅ Yes | ✅ Yes (PCRE) | ✅ Native |
| AdGuard Home | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Native |
| Dnsmasq | ✅ Yes | ✅ Yes (address=/.../) |
❌ No* | |
| Unbound | ✅ Yes | ✅ Yes | ❌ No* |
- Pi-hole & AdGuard Home: These have a dedicated "allowlist" database that takes precedence over blocklists automatically.
- Dnsmasq:
address=/example.com/0.0.0.0, it automatically blockssub.example.comanddeep.sub.example.com. - Unbound: It uses
local-zoneandlocal-datadirectives. Setting a zone toalways_nulloralways_nxdomainacts as a wildcard block. For whitelisting, we must manage the exclusion by ensuring the whitelist entry is more specific than the block entry.
cargo install adblockptimize # split a list into network and browser files adblockptimize https://example.com/list.txt local-list.txt # dnsmasq format, network rules only adblockptimize --no-browser --format=dnsmasq https://example.com/list.txt # custom output file names adblockptimize --network-file=dns.txt --browser-file=ublock.txt https://example.com/list.txt