2 min read

$5 ESP32 ad blocker stores 537,000 domains

An ESP32-C3 backup DNS filter can block 537,000 domains using 40-bit hashes, about 50KB of RAM, and roughly 10ms lookup times.

Image: Hacker News

A $5 ESP32-C3 SuperMini can act as a network-wide ad-blocking DNS filter with 537,000 blocked domains, using only around 50KB of RAM and answering blocked lookups in roughly 10 milliseconds.

That’s the approach taken by Egyptian full-stack developer ZedAxis (@M-Abozaid on GitHub), who built the tiny device as a backup DNS server for his home network. His main setup is a Pi-hole running on a Raspberry Pi, while the ESP32 steps in when the primary system is rebooting or unavailable.

A photo of the tiny ESP32 SuperMini board, bare of any casing.
A photo of the tiny ESP32 SuperMini board, bare of any casing.

The hardware is modest: 400KB of RAM and 4MB of flash memory. That isn’t enough to store a large plaintext blocklist, so ZedAxis hashes domains instead. He uses 40-bit FNV-1a hashes as a middle ground: 32-bit creates too many collisions, while 64-bit takes up too much space.

Recommended reading

Quantum’s real shift is hybrid computing

A screenshot of the rudimentary GUI for the C3 AdBlocker.
A screenshot of the rudimentary GUI for the C3 AdBlocker.

The build process downloads public blocklists, removes duplicates and comments, hashes each domain, sorts the results, and writes the database to flash. When a DNS request comes in, the firmware hashes the hostname and runs a binary search against the sorted table. If there’s a match, the request is blocked; if not, it is sent to an upstream resolver.

There’s also a tradeoff around storage. The ESP32 normally keeps space for two firmware copies to support over-the-air updates safely. If OTA support stays enabled, the project can block about 250,000 domains. Disabling OTA frees enough flash to reach roughly 537,000 domains.

I built a $2 ad blocker for my whole network - YouTube
I built a $2 ad blocker for my whole network - YouTube

The project is not meant to replace Pi-hole or AdGuard Home. Tom’s Hardware notes that the dashboard is basic and lacks per-client statistics, historical query logs, and the broader controls available in full installations. The point is resilience: a tiny, low-power fallback that keeps filtered DNS running instead of dropping clients onto whatever resolver the router is configured to use.

A photo of a tiny ad-blocking device plugged into a home fiber gateway device.
A photo of a tiny ad-blocking device plugged into a home fiber gateway device.

ZedAxis powers the device from the USB port on a Huawei OptiXstar home fiber gateway. The USB link provides only 5 volts; all networking happens over the ESP32's built-in Wi‑Fi.

Marcus Vance

Enterprise Editor

Marcus follows the money. He covers enterprise software, cloud architecture, and the tectonic shifts in Big Tech strategy. He translates dense earnings calls and complex M&A activity into actionable insights about where the industry is actually heading. If a tech giant makes a silent pivot, Marcus is usually the first to notice.

via Hacker News

// Keep reading