Ads are intrusive and irritating, and while ad blockers do a decent job on desktop browsers, they don't work on phones and tablets. That's where Pi-hole comes in. Pi-hole is a free network-level service that blocks ads on all devices across your entire home Wi-Fi network. Let's see how it works, and how you can set it up on your home Wi-Fi network.
Products used in this guide
- Never see ads: CanaKit Raspberry Pi 4 4GB Starter Kit ($100 at Amazon)
Know what Pi-hole can (and cannot) do before you start
Pi-hole is a fantastic utility for eliminating ads on all devices connected to your home Wi-Fi network, but it has its limitations. If you're setting up Pi-hole to block ads on YouTube or Instagram, you'll be let down because these sites use their own CDNs (content delivery network) for serving ads, so the server that rolls out the video also includes the ads.
Pi-hole loads pages faster and saves bandwidth, but it does not block ads from YouTube or Instagram.
Most online ads are delivered by third-party sites, so it's easy for a service like Pi-hole to identify the sites that serve these ads and block them. That isn't the case with YouTube, so there's no way to block an ad on the video streaming platform without blocking access to the video itself. If you want ad-free YouTube, you'll have to pay for YouTube Premium. The same holds true for Instagram, and there really isn't any way to block ads on the Facebook-owned service.
Having said that, Pi-hole does a great job getting rid of ads you see on most websites, generally leading to a faster internet usage experience. Without having to load all the sites that contain the ads, you'll see a noticeable decrease in bandwidth while browsing, and pages load faster as a result. For instance, on my home Wi-Fi network, Pi-hole usually blocks around 10-20% of all outgoing traffic requests, and that means up to one-fifth of my bandwidth was previously used up by ad servers.
How does Pi-hole work anyway?
Think of Pi-hole as the ad police. Normally when you open a site on your phone (like usatoday.com), the request is sent to a DNS server — that's like a phone directory, but for the internet. Alongside the request for usatoday.com, your browser also gets queries for other domains that serve ads on USA Today's site. So essentially, your browser is loading content from several sites in the background.
This is where Pi-hole makes a difference. When you're using Pi-hole and visit usatoday.com, it will download the content from the site, but intercepts all the other domains that serve ads on the site. This way, you're getting all the content on USA Today, but without any of the ads. This is a more elegant solution than using an ad blocker on a browser because data from the domains that serve ads isn't loaded in the first place. Ad blockers still load all the ads, but just hide the elements from view, so your browser is still downloading all the content from the ad sites.
Pi-hole is like a security guard that doesn't allow ads to get in.
That is not the case with Pi-hole, and that's what makes it an incredible utility. Just set it up and point your router to Pi-hole, and it will automatically block ads across all of your devices. Pi-hole has a blacklist of over 127,000 domains — with more added monthly — so regardless of whatever site you visit, Pi-hole does a great job blocking ads on that page.
The best part about Pi-hole is that it has a web interface that makes it easy to see all the queries it has blocked in real-time. Now that you have a high-level overview of how Pi-hole works, let's see how to set it up on your home Wi-Fi network.
What you need to set up Pi-hole on your home Wi-Fi network
- Raspberry Pi 2, 3, or 4: I recommend using the Pi 4 as it comes with built-in Wi-Fi, beefier hardware and offers great value. You can choose from 1GB, 2GB, or 4GB RAM configurations, and I have the 4GB option as that gives me more overhead for adding more things later on. If you're getting one for just Pi-hole, I'd suggest going with the 2GB RAM variant.
- Case: You'll ideally need an enclosure with your Raspberry Pi, and this one is designed for the Pi 4 and comes with a fan. Not bad at all for under $10.
- 32GB MicroSD card: You'll need a microSD card to install Raspbian, the Raspberry Pi's official operating system. A 32GB card is more than sufficient, and comes in at under $10.
- 15W wall plug: Your Raspberry Pi needs an external power source, and you can pick one up on Amazon. The wattage of the wall unit varies based on the Pi model you're picking up. I'm using the Pi 4 here, and it needs a USB-C 15W wall plug.
- Ethernet cable: It's recommended to plug in your Raspberry Pi to your router via an Ethernet cable. The Pi 4 has a built-in Wi-Fi modem, but as you're going to use it to route all internet traffic, it's a better idea to plug in.
- Micro-HDMI cable: The Pi 4 has two micro-HDMI ports, so you'll need a micro-HDMI to HDMI cable to connect it to your monitor.
You can pick up all of the components individually, or get them as a kit. I'm partial to this Canakit Raspberry Pi 4 starter kit as it has everything you need in a single package. That includes a 4GB Raspberry Pi 4, a case, heat sink, fan, 32GB Samsung Evo MicroSD card, 15W power adapter, and a micro-HDMI cable. It will cost you more to pick up all the accessories, and it makes sense to pick up a bundle.
How to set up a Raspberry Pi
Before you can install Pi-hole, you'll need to set up your Raspberry Pi. If this is the first time you're using a Pi, your best bet is to download and install NOOBS, an easy-to-use installer that contains all major operating systems for the Raspberry Pi.
In this guide I'm going to highlight how you can install NOOBS on a Pi 4 and set it up. Let's get started.
- Download NOOBS from this link and extract the ZIP file.
- Connect the MicroSD card that will be used inside the Pi 4 to a Windows PC.
- Format the MicroSD card in FAT file format. You can use the built-in utility in Windows to do so. Just right-click on the drive name for the MicroSD card, select Format, choose the File system as FAT, and hit Start.
- If you're running into issues formatting your SD card, use the SD Association's Formatting Tool.
- Once the SD card is formatted, copy the contents of the extracted NOOBS ZIP file to the SD card. Make sure that the files aren't transferred to a folder within the SD card. They should be in the root directory of the SD card.
- Slot in the SD card inside the Pi 4, connect it to a monitor and keyboard, and boot it up.
- Follow the instructions on-screen to install the operating system. You should be installing Raspbian.
Add a static IP for Raspberry Pi on your router
As we're setting up Pi-hole to handle all incoming traffic, you should set up a static IP for the Raspberry Pi on which Pi-hole will be installed. It's pretty straightforward, and here's how you can do so:
- Go to your router's administration interface (it's usually 192.168.1.1) and log in with your credentials.
- Navigate to the LAN menu, and select DHCP Server.
- Select Manual Assignment to On, and you should see a Manually Assigned IP table at the bottom of the page.
- Select your Raspberry Pi from the list of devices, and assign it a static IP address. In this instance, I'm assigning 192.168.1.51 to my Pi 4.
- Save the changes.
How to install Pi-hole on a Raspberry Pi
Once Raspbian is set up and you've assigned a static IP to your Raspberry Pi, you can install Pi-hole. Here's how to do so:
- Launch the command shell from the Start menu.
wget -O basic-install.sh https://install.pi-hole.net sudo bash basic-install.shand it should download the installer for Pi-hole.
- The automated installer should pop up on the screen. Hit Ok to get started.
- You'll see a dialog box on whether to use the Raspberry Pi as the DHCP server. Hit No.
- Now you have to set an interface for the Pi-hole. Choose eth0 if your Raspberry Pi is connected to your router over an Ethernet cable. Go with wlan0 if you're using the Pi 4's Wi-Fi modem.
- Select an upstream DNS provider. You can pick from any of the providers listed, but Google or Cloudflare would be my picks.
- Now you get to pick the blocklists. It's a good bet to leave this as is, as the default lists do a good job filtering out most ads. If needed, there's the option to add more lists later on.
- Select your IP protocol. For most users, this will have to be IPv4.
- Confirm the static IP of your Raspberry Pi. Make sure this is the same address that you keyed in to the router, because otherwise you won't be able to connect to the internet.
- Next, you'll be asked if you want to install the Pi-hole web interface. Choose On and hit Ok.
- Choose On to install the web server for the Pi-hole web interface.
- Select On at the Do you want to log queries? page.
- The installation is finalized, and you should see a password for the web interface. Note this down.
Configuring Pi-hole on your router
Once you finish installing Pi-hole, you should set it up as the DNS server on your router. This is required for Pi-hole to work. Otherwise, your router will rely on your internet service provider to resolve DNS queries, and you will still see ads.
- Go to your router's administration interface (192.168.1.1) and log in with your credentials.
- Navigate to the LAN menu.
- In the DNS Server filed, enter the Static IP of your Raspberry Pi. As I set my Pi 4's address to 192.168.1.51, that's what I'll enter here.
- Save the changes.
That's all there is to it! To test if the Pi-hole is working, go to the web interface and see if it is filtering ads. For this, you'll have to navigate to the static IP you set for your Raspberry Pi. For me, it is 192.168.1.51, so the web interface for the Pi-hole I set up is at 192.168.1.51/admin.
Once the page loads, you'll be able to log in by using the password that was provided during the installation. You'll be able to see all devices on your home Wi-Fi, and see detailed information on all the queries (and domains) Pi-hole has blocked access to in real-time.
Never see ads
Small in size, big on power
The Raspberry Pi 4 is an incredible machine in its own right, and this starter kit makes it easy to get started with the computer. The Pi 4 features robust hardware and a Wi-Fi modem for the first time, and the extensibility on offer here makes it a standout device.
Raspberry Pi 4 (4GB) ($62 at Amazon)
The Raspberry Pi 4 has everything you need in a compact package: quad-core chipset, built-in Wi-Fi modem, and Bluetooth 5.0.
Vilros Raspberry Pi 4 Case ($10 at Amazon)
This case is ideal to show off your Pi 4, and comes with a fan to dissipate heat effectively.
Samsung Evo 32GB MicroSD Card ($8 at Amazon)
You need a MicroSD card to run the Raspberry Pi OS, and Samsung's Evo is the ideal option.
LABISTS USB-C 15W Power Adapter ($9 at Amazon)
The Pi 4 needs a 5V 3A wall plug that connects over USB-C. You can use one that came with an old phone, or pick this up.
AmazonBasics Ethernet Cable ($6 at Amazon)
You should ideally connect your Pi 4 to your router over Ethernet, and AmazonBasics has an excellent selection of Ethernet cables.
UGREEN Micro-HDMI to HDMI Cable ($9 at Amazon)
The Pi 4 has two micro-HDMI ports, so you'll need to get a micro-HDMI to HDMI cable to hook it up to your monitor.
We may earn a commission for purchases using our links. Learn more.