Pi-hole is free, open-source software that blocks ads, trackers, and malicious domains for every device on your network at once. It works as your network’s DNS server: when a phone, laptop, or smart TV asks for the address of a known ad or tracking domain, Pi-hole answers with nothing, so the ad never loads.
Browser ad blockers only protect one browser on one device. Your smart TV, game console, phones, tablets, and the apps on them all phone home to ad and analytics servers that a browser extension can’t touch. Pi-hole solves this at the network level: install it once, on something as small as a Raspberry Pi, and every device that uses your network gets the same filtering, with nothing to install on each one.
This guide explains how Pi-hole works, what you need, how to install it on a Raspberry Pi or with Docker, how to point your network at it, and what it can and can’t block.

How Pi-hole Works: DNS Filtering
Every time a device loads a website or an app contacts a server, it first asks a DNS server to turn a name like example.com into an IP address, the number computers use to find each other. (The computer networking guide explains DNS and IP addresses in more detail.) Normally, that DNS server belongs to your internet provider or a public service like Google or Cloudflare.
Pi-hole puts itself in the middle as your network’s DNS server:
- A device asks Pi-hole for the address of a domain, like
doubleclick.net. - Pi-hole checks the domain against its blocklists, lists of hundreds of thousands of known ad, tracking, and malware domains.
- If the domain is on a list, Pi-hole answers with
0.0.0.0, an address that goes nowhere, so the ad or tracker never loads. - If it isn’t, Pi-hole forwards the question to an upstream DNS server (like Cloudflare or Quad9), returns the real address, and caches it so the next request is even faster.
Here’s what that looks like from a computer using Pi-hole, asking for an ad domain and then a normal one with the dig tool:
dig doubleclick.net +short
dig example.com +short
0.0.0.0
104.20.23.154
172.66.147.243
The ad domain gets 0.0.0.0; the normal site gets its real addresses. Web pages load around the empty space where an ad would have been, and often load faster, because there’s less to download.
What Pi-hole Gives You
- Network-wide blocking: phones, smart TVs, consoles, streaming sticks, and Internet of Things devices are all covered, including ones that can’t run an ad blocker.
- Fewer trackers: blocking analytics and telemetry domains reduces how much your devices report about you.
- Some protection from malware and phishing: blocklists include known malicious domains, and you can add security-focused lists.
- Faster browsing: fewer ads to download, plus a local DNS cache.
- Visibility: a web dashboard shows which devices make the most requests and which domains they contact. Seeing a smart TV contact tracking domains every few seconds is eye-opening.
- Control: allow or block any domain for the whole network in seconds.
What You Need
- A device that’s always on. Pi-hole needs very little power: a Raspberry Pi (even a small model like the Pi Zero 2 W), an old laptop, a mini PC, a Linux virtual machine, or a home server running Docker all work. See Raspberry Pi for Beginners if you’re starting from scratch.
- A wired connection, if possible. DNS is used constantly, so a stable Ethernet connection is better than Wi-Fi.
- A static IP address for the Pi-hole device, so your network can always find it. The easiest way is a DHCP reservation in your router’s settings, which always gives the device the same address.
- Access to your router’s settings, to tell your network to use Pi-hole.
Option 1: Install on a Raspberry Pi or Linux
On Raspberry Pi OS, Debian, Ubuntu, or another supported Linux distribution, Pi-hole’s official installer does everything:
curl -sSL https://install.pi-hole.net | bash
The installer walks you through a few screens: choose an upstream DNS provider, keep the default blocklist, and confirm the network settings. At the end it shows the address of the web dashboard and a password to sign in.
Piping a script from the internet straight into bash is convenient, but you’re running code you haven’t read. If you’d rather check it first, download it, read it, and then run it:
curl -sSL https://install.pi-hole.net -o install-pihole.sh
less install-pihole.sh
sudo bash install-pihole.sh
To change the dashboard password later, run pihole setpassword. The Linux terminal guide covers the basics if these commands are new to you.
Option 2: Run Pi-hole in Docker
If you already run a home server with Docker, Pi-hole’s official image is the cleanest option. Save this as docker-compose.yml:
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
- "443:443/tcp"
environment:
TZ: "America/Los_Angeles"
FTLCONF_webserver_api_password: "choose-a-strong-password"
FTLCONF_dns_listeningMode: "all"
volumes:
- "./etc-pihole:/etc/pihole"
restart: unless-stopped
Then start it:
docker compose up -d
A few notes:
- Settings are environment variables. Pi-hole version 6 reads any setting from a variable named
FTLCONF_plus the setting’s name, soFTLCONF_webserver_api_passwordsets the dashboard password. Settings defined this way are locked in the web interface, so change them in the file and rundocker compose up -dagain. FTLCONF_dns_listeningMode: "all"lets Pi-hole answer the rest of your network. By default Pi-hole only answers devices it sees as local, and through Docker’s network your other devices can look like they’re coming from outside.- Port 53 must be free on the host. On some Linux systems, a built-in DNS service (
systemd-resolved) already uses it and has to be adjusted first. - The
etc-piholefolder keeps your settings and lists, so they survive container updates. To update, rundocker compose pullanddocker compose up -d.
Use a long, unique password, not the placeholder shown here.
Point Your Network at Pi-hole
Pi-hole only filters devices that use it as their DNS server. There are three ways to set that up:
- Change the DNS server in your router (best). In your router’s DHCP or LAN settings, set the DNS server to the Pi-hole’s IP address. Every device that joins the network picks it up automatically, though some may need to reconnect or restart. Router menus differ by brand; look for “DNS server” under DHCP or LAN settings.
- Use Pi-hole as your DHCP server. Some routers, especially ones from internet providers, don’t let you change the DNS server. In that case, turn off the router’s DHCP server and enable the one built into Pi-hole (Settings > DHCP), so Pi-hole hands out both IP addresses and DNS settings. Only one DHCP server can run on a network.
- Set it on individual devices. For testing, or to filter only some devices, enter the Pi-hole’s IP address as the DNS server in each device’s network settings.
Don’t add a public DNS server as a “secondary” DNS. Devices don’t use the second server only as a backup; many use both, so ads leak through the public one. If you want redundancy, run a second Pi-hole and list both.
To check that a device is using Pi-hole, open a terminal on it and look up an ad domain. On Windows:
nslookup doubleclick.net
If the answer is 0.0.0.0, the device is protected. The request also appears in the dashboard’s Query Log. (If you manage Windows computers, the PowerShell beginner’s guide shows how to check this on many machines at once.)
Using the Dashboard
Open http://<pi-hole-ip>/admin in a browser and sign in. The main sections are:
- Dashboard: total queries, the percentage blocked, and the top clients and domains.
- Query Log: every DNS request, which device made it, and whether it was blocked. This is where you go when something breaks.
- Domains: add domains to the allowlist (never block) or denylist (always block).
- Lists: add or remove blocklists. Pi-hole starts with one well-maintained list; add more under Lists and then update gravity (below).
- Settings: upstream DNS servers, DHCP, privacy level, and more.
Useful Commands
The same tasks are available from the command line, on the Pi-hole device or with docker exec -it pihole in front for Docker:
| Command | What it does |
|---|---|
pihole status | Shows whether DNS and blocking are running |
pihole -q doubleclick.net | Shows which list blocks a domain |
pihole allow example.com | Adds a domain to the allowlist |
pihole deny example.com | Adds a domain to the denylist |
pihole allow remove example.com | Removes a domain from the allowlist |
pihole disable 5m | Pauses blocking for 5 minutes |
pihole enable | Turns blocking back on |
pihole -g | Updates the blocklists (“gravity”) |
pihole -t | Shows the live query log |
pihole -up | Updates Pi-hole (not used in Docker; pull a new image instead) |
pihole setpassword | Changes the dashboard password |
Allowlist and denylist changes take effect within a second or two, with no restart needed.
Choosing an Upstream DNS Server
Pi-hole sends every query it doesn’t block to an upstream DNS server. Common choices:
| Provider | Addresses | Notes |
|---|---|---|
| Cloudflare | 1.1.1.1, 1.0.0.1 | Fast, with a strong privacy policy |
| Quad9 | 9.9.9.9, 149.112.112.112 | Also blocks known malicious domains |
8.8.8.8, 8.8.4.4 | Fast and widely used |
For more privacy, advanced users pair Pi-hole with Unbound, a recursive resolver that looks up domains directly from the internet’s root servers instead of trusting one company with all your DNS queries.
What Pi-hole Can’t Block
Pi-hole is powerful, but it has real limits. Knowing them avoids frustration:
- Ads served from the same domain as the content. YouTube, Twitch, and some streaming apps deliver ads from the same servers as the videos, so blocking the ads would block the video. A browser ad blocker like uBlock Origin is still useful on computers.
- Devices with hard-coded DNS. Some devices, notably some smart TVs and streaming sticks, ignore your network’s DNS and use their own, such as Google’s
8.8.8.8. Blocking that requires firewall rules on your router. - Encrypted DNS in browsers and apps. DNS over HTTPS (DoH) sends DNS queries inside regular web traffic, bypassing Pi-hole. Pi-hole handles the common cases: by default it tells Firefox to use the network’s DNS and turns off iCloud Private Relay on Apple devices on your network, but other apps can still bypass it.
- Devices away from home. A phone on mobile data isn’t using your network. To keep Pi-hole’s protection everywhere, connect back home with a VPN; Tailscale can use your Pi-hole as the DNS server for all your devices.
- Occasional broken sites. A blocklist sometimes catches a domain a site or app needs, like a login service or a link-tracking domain in an email. Check the Query Log, find the blocked domain, and allowlist it.
Keep Pi-hole Secure
- Never expose Pi-hole to the internet. Don’t forward port 53 or the dashboard ports on your router. An open DNS server can be abused in attacks against others, and the dashboard isn’t meant to face the internet. Use a VPN to reach it remotely.
- Keep it updated. Several security vulnerabilities in Pi-hole’s components were found and fixed in 2026. Run
pihole -upregularly, or pull the latest Docker image. - Use a strong dashboard password. Anyone with dashboard access can change your network’s DNS behavior.
- Back up your settings. Settings > Teleporter exports your configuration, lists, and allowlist to a file. Keep a copy somewhere else, following the 3-2-1 backup rule.
Pi-hole vs. Other DNS Filtering
Pi-hole is ideal for homes, home labs, and small offices. Schools and larger organizations usually need features Pi-hole doesn’t focus on, like per-user policies, category filtering, reporting for compliance, and protection that follows devices off the network. See K-12 DNS Filtering for how that works at scale. Hosted services like NextDNS and AdGuard DNS offer similar blocking without running your own server, and AdGuard Home is a self-hosted alternative to Pi-hole.
Frequently Asked Questions
Is Pi-hole free?
Yes. Pi-hole is free, open-source software. The project is supported by donations.
Does Pi-hole slow down my internet?
Usually the opposite. DNS lookups are tiny, and Pi-hole caches answers, so repeat lookups are faster. Pages also load less ad content. The main risk is downtime: if the Pi-hole device goes offline, DNS stops working for the whole network, so run it on reliable hardware or run two.
Does Pi-hole block YouTube ads?
Not reliably. YouTube serves ads from the same domains as its videos, so DNS filtering can’t separate them. Use an ad blocker in the browser for YouTube.
Do I need a Raspberry Pi?
No. Pi-hole runs on most Linux systems, in a virtual machine, or in Docker on almost any always-on computer. A Raspberry Pi is just a cheap, low-power option.
What happens if Pi-hole stops working?
Devices can’t look up domain names, so the internet appears to be down. To recover quickly, set your router back to its default DNS settings, and consider a second Pi-hole for redundancy.
Conclusion
Pi-hole is one of the most useful projects you can run at home: a small, always-on device that blocks ads, trackers, and malicious domains for every device on your network, with a dashboard that shows exactly what your devices are doing. Install it on a Raspberry Pi or in Docker, give it a fixed IP address, point your router’s DNS at it, and keep it updated. It won’t catch every ad, but it will quietly make your whole network cleaner, faster, and more private.
