esp32-c3-adblock: ESP32-C3 DNS ad blocker
esp32-c3-adblock is a practical DNS ad blocker for an ESP32-C3, especially when a Pi-hole-style setup is needed without PSRAM. It stores sorted 40-bit FNV-1a hashes in flash, uses binary search for lookups, and includes a UDP DNS sinkhole, dashboard, and OTA updates. Checked 2026-11-30: MIT licence, last push 2026-11-06.
The PSRAM memory bottleneck
The ESP32-C3 normally has little memory for a large DNS blocklist, especially when PSRAM is absent. esp32-c3-adblock avoids keeping domain strings in RAM by converting domains into fixed 5-byte FNV-1a hashes, storing the sorted table in flash, and finding matches with binary search. A listed domain also blocks its subdomains.
Blocking, dashboard, and OTA features
- ✓Runs on ESP32-C3 boards without PSRAM, and also builds for classic ESP32 and ESP8266 targets.
- ✓Stores the blocklist as sorted 40-bit FNV-1a hashes in flash, with binary search instead of RAM-heavy string comparisons.
- ✓Answers blocked queries with 0.0.0.0 and forwards permitted DNS traffic to a configurable upstream resolver.
- ✓Provides a web dashboard for client statistics, custom blocked domains, client bans, and Wi-Fi configuration.
- ✓Supports blocklist uploads, scheduled remote blocklist updates, firmware OTA, and network OTA after the initial USB flash.
- ✓Uses a captive Wi-Fi setup portal, mDNS discovery through c3adblock.local, and a LittleFS blocklist filesystem.
- ✓Accepts hosts files, plain domain lists, and basic AdGuard or Adblock rules when building a blocklist.
Advantages of flash-stored hashes
- ✓Flash storage keeps RAM use small, making the project suitable for boards without PSRAM.
- ✓The fixed-size hash table fits more domains into a flash budget than storing full domain strings.
- ✓Binary search provides a simple lookup path without rebuilding the entire blocklist in RAM.
- ✓A listed domain blocks its subdomains, which covers many tracking and advertising patterns without separate rules.
- ✓The dashboard and OTA workflow make the device maintainable after deployment.
- ✓Separate PlatformIO environments support ESP32-C3, classic ESP32, and ESP8266 hardware without treating one binary as universal.
Hardware, network, and security limits
- △The ESP8266 target is slower and more constrained: its smaller index and cache reduce capacity, and the README says it identifies clients by IP rather than MAC.
- △Flash partitioning creates a real tradeoff: firmware OTA leaves roughly 1.3 MB for the blocklist, while the largest 537k-domain list requires the single-app layout without firmware OTA.
- △The dashboard uses plain HTTP. The README's Security section notes that Basic Auth is a LAN trust-boundary control, not encryption, so credentials can be read by an on-path attacker.
- △The Wi-Fi setup access point is intentionally open and unencrypted; the README says the real network password is exposed during the brief setup window.
- △Hash collisions remain possible at larger blocklist sizes: the README estimates about one collision at 537k domains, which can over-block one domain.
- △The ESP8266 filesystem and index settings are fixed by its build configuration; a much larger list may require increasing `INDEX_Entries` and `MAX_RANGE`.
Build and flash with PlatformIO
Build with a current PlatformIO installation; the README warns that an outdated package fails on the C3 build. Copy src/secrets.example.h to src/secrets.h and replace the dashboard and OTA password placeholders. Build the default blocklist with `python3 tools/build_blocklist.py data/blocklist.bin`, then flash the firmware and filesystem with `pio run -t upload` and `pio run -t uploadfs`. Classic ESP32 builds use `-e esp32dev` on both commands. The initial flash requires USB; after that, firmware and blocklist updates can use Wi-Fi.
Configure DNS and wireless updates
After booting, open the dashboard at `http://c3adblock.local` or use the device IP. Point clients at the ESP32-C3 as their DNS server, or configure it as a secondary resolver. Select Quad9, another IPv4 resolver, or the router's DNS from the dashboard's upstream settings. Upload a prepared blocklist, schedule a remote blocklist download, or update firmware through the dashboard. The resolver is IPv4-only, so routers that advertise IPv6 DNS through RDNSS or DHCPv6 can let clients bypass it.
Pi-hole and AdGuard alternatives
Who should use this ESP32 blocker
Choose esp32-c3-adblock when you want Pi-hole-style DNS blocking on a microcontroller, especially an ESP32-C3 without PSRAM, and can accept IPv4-only DNS, plain HTTP management, and firmware-specific flash constraints. It is better suited to a small network, IoT setup, or spare development board than to users who want a general-purpose DNS platform.
Frequently asked questions
Yes. esp32-c3-adblock is designed for ESP32-C3 boards without PSRAM: the blocklist is kept in flash as fixed 40-bit FNV-1a hashes rather than domain strings in RAM. The README reports about 50 KB of RAM use for its 141k-domain comparison.
esp32-c3-adblock supports any ESP32-C3 board with 4 MB flash as its main target. It also builds for classic ESP32 boards such as DevKit and WROOM, and for ESP8266 boards such as NodeMCU and D1 mini. Each target has its own PlatformIO build environment.
Yes. After the initial USB flash, esp32-c3-adblock can upload firmware and blocklist files through its dashboard, schedule remote blocklist downloads, and use ArduinoOTA. Firmware OTA requires the partition layout that leaves space for two app slots.
No. The esp32-c3-adblock dashboard is served over plain HTTP on port 80. The README explains that Basic Auth protects state-changing endpoints, but it does not encrypt credentials, so the management interface should be treated as a local-network trust boundary.
Capacity depends on the partition layout and list size. The README lists 141k domains in about 0.67 MB of flash for its comparison, says the 537k-domain list fits only with a single-app partition, and notes that firmware OTA leaves about 1.3 MB, or roughly 250k domains maximum.
esp32-c3-adblock uses the MIT licence. The README links the project’s LICENSE file, so the repository’s licence file is the source for the permitted use and distribution terms.
Best use cases
- •Protect a small home network without installing a separate Linux server or adding PSRAM to the board.
- •Use an ESP32-C3 as a DNS sinkhole for IoT devices that need advertising and tracking domains filtered.
- •Run the blocker on a NodeMCU or D1 mini as an ESP8266 DNS sinkhole when a low-cost spare microcontroller is available.
- •Add local DNS filtering beside an existing resolver while keeping the router as the main source of client addresses.
- •Maintain a remote appliance through scheduled blocklist downloads and firmware updates over Wi-Fi.
Related repositories
Is esp32-c3-adblock worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of esp32-c3-adblock.
