How to block ads on every device in your home with a Raspberry Pi
Key takeaways
- Pi-hole blocks ads at the DNS level so every device on your network is covered without installing anything on each one
- A Raspberry Pi 5 with a microSD card is all the hardware you need and the whole setup takes about twenty minutes
- The default blocklists catch most advertising and tracking domains out of the box and you can add more later
- You can set Pi-hole as your DHCP server or point your router at it manually depending on how much control your router gives you
This article contains affiliate links. We may earn a small commission if you make a purchase, at no extra cost to you. Full disclosure.
Last updated: 12 September 2026
You know that moment where you hand someone your phone to show them a photo and an ad for protein powder takes over the screen? Or when your smart TV slides a banner across the bottom of a show you are already paying to watch? That is the problem Pi-hole solves, and it solves it for every device in your house at once.
Pi-hole is a free, open-source DNS sinkhole that runs on a Raspberry Pi (or any Linux box, really). Instead of blocking ads inside each browser or app, it intercepts the DNS queries that fetch them before they reach any device on your network. Phones, laptops, smart TVs, games consoles, smart speakers. Everything connected to your Wi-Fi gets ad blocking without installing a single app.
Here is how to set the whole thing up in about twenty minutes.
What you need
The hardware list is short:
A Raspberry Pi 5 with 8GB of RAM is the current sweet spot. The 4GB model works fine for Pi-hole alone, but the 8GB version leaves room to run other services later. If you already have a Pi sitting in a drawer, that works too. Pi-hole runs comfortably on a Pi 3 or newer.
You will also need a microSD card (32GB is plenty), a USB-C power supply, and an Ethernet cable. Wi-Fi works but Ethernet is more reliable for something that handles every DNS request on your network.
If you have not set up a Pi before, our Raspberry Pi home server guide walks through the initial OS install.
Step one: give your Pi a static IP
Pi-hole needs a static IP address because every device on your network will point at it for DNS. If the address changes, everything stops resolving.
The easiest way is to assign a static lease in your router's DHCP settings. Find your Pi's MAC address, give it a fixed IP like 192.168.0.50, and you are done. Alternatively, you can set it in the Pi's network config directly.
Step two: install Pi-hole
SSH into your Pi and run the one-line installer:
curl -sSL https://install.pi-hole.net | bash
The installer walks you through a series of prompts. The defaults are sensible for most setups. It will ask you to confirm your static IP, choose an upstream DNS provider (Cloudflare at 1.1.1.1 or Google at 8.8.8.8 are both fine), and select the default blocklists.
If you prefer not to pipe a script straight into bash, you can also clone the repository and run the installer locally:
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
cd Pi-hole/automated\ install/
sudo bash basic-install.sh
The install takes a few minutes. At the end it gives you a randomly generated admin password for the web dashboard. Write it down or change it with pihole -a -p afterwards.
Step three: point your network at Pi-hole
This is where the magic happens. You have two options depending on how cooperative your router is.
Option A: change your router's DNS settings. Log into your router's admin panel (usually 192.168.0.1 or 192.168.1.1), find the DNS settings under LAN or DHCP, and replace whatever is there with your Pi's static IP. Every device that connects to your Wi-Fi will now use Pi-hole automatically.
Option B: let Pi-hole handle DHCP. Some ISP-provided routers do not let you change DNS settings. In that case, disable DHCP on your router and enable it in Pi-hole's settings instead. Pi-hole then hands out IP addresses to your devices and sets itself as the DNS server in the process. This sounds more complicated than it is. The Pi-hole dashboard has a toggle for it.
Option A is cleaner if your router supports it. Option B works with basically any router, including the locked-down ones from your broadband provider.
Step four: check it is working
Open the Pi-hole admin dashboard at http://[your-pi-ip]/admin in any browser. You should see queries starting to appear almost immediately. The dashboard shows you exactly how many queries are being blocked, which domains are getting caught, and which devices are making the most requests.
The default blocklists are genuinely good. They cover the major ad networks, tracking domains, and telemetry endpoints that most people want blocked. You will probably notice a difference on ad-heavy sites within seconds.
What Pi-hole blocks (and what it does not)
Pi-hole is brilliant at blocking third-party ads and trackers: the ones served from dedicated advertising domains. Banner ads, pop-ups, tracking pixels, and most of those cookie consent prompts that load from external domains.
It will not block ads that are served from the same domain as the content. YouTube ads are the obvious example. Because they come from youtube.com itself, Pi-hole cannot block them without also blocking the videos. For those, you still need a browser extension like uBlock Origin.
That said, the amount it does catch is significant. Most Pi-hole users report 20 to 40 percent of all DNS queries being blocked, which translates to noticeably faster page loads and less visual clutter across every device.
Adding more blocklists
The default lists are a good start, but the community maintains larger ones. In the Pi-hole dashboard, go to Adlists and add URLs for additional blocklists. Popular choices include:
The Firebog curated list is a well-maintained collection sorted by category. Start with the ones marked as safe (green ticks) and add more if you want tighter blocking.
After adding new lists, run pihole -g in the terminal to update the gravity database, which is Pi-hole's term for its master blocklist.
Keeping it running
Pi-hole is genuinely low-maintenance. The gravity database updates automatically on a weekly schedule. The Pi itself draws so little power that you can leave it running indefinitely. If you are already running a home server, Pi-hole is an obvious addition to the stack.
The only thing worth checking occasionally is the query log. If a site breaks, it is usually because Pi-hole blocked a domain it should not have. The dashboard lets you whitelist individual domains with one click.
For anyone thinking about broader network security, Pi-hole is one piece of a setup that also includes keeping firmware updated, using strong Wi-Fi passwords, and segmenting IoT devices onto their own VLAN.
Frequently asked questions
Does Pi-hole slow down my internet?
No. DNS resolution on a Raspberry Pi typically takes one to two milliseconds. It is faster than most ISP DNS servers because Pi-hole caches responses locally and never has to look up blocked domains at all.
Can I still see ads if I want to?
Yes. You can either whitelist specific domains in the dashboard or temporarily disable Pi-hole for a set period, anywhere from 30 seconds to indefinitely. Useful for the rare site that gates content behind ad blockers.
Does it work with a VPN?
Yes. If you run a VPN server on your network (something like WireGuard on the same Pi), you can route your DNS through Pi-hole even when you are away from home. Your phone gets ad blocking on mobile data.
How do I block ads on my iPhone or Android without Pi-hole?
You can point individual devices at Pi-hole by changing their DNS settings manually, but the whole point is that Pi-hole handles this at the network level so you do not have to configure each device. Set it up once on your router and everything is covered.
What happens if the Pi goes down?
Your devices will fail to resolve DNS until you either bring the Pi back online or change your router's DNS settings back to your ISP's defaults. This is why some people run two Pi-hole instances for redundancy, though for a home setup the simplicity of one is usually fine.
The bottom line
Pi-hole is one of those projects where the effort-to-reward ratio is absurdly good. Twenty minutes of setup gets you network-wide ad blocking that works on devices you cannot even install software on, like smart TVs and IoT gadgets. The Raspberry Pi 5 handles it effortlessly alongside other lightweight services, and the whole thing runs on less electricity than a phone charger.
If you are already into self-hosting or thinking about a home server OS, Pi-hole should probably be the first thing you install. It takes minutes, it costs almost nothing to run, and every person who uses your Wi-Fi benefits immediately.
Some links in this article are affiliate links. We may earn a small commission at no extra cost to you.