Block YouTube with Pi-hole v6 (Network-Wide DNS Block)
Block YouTube on every home device with Pi-hole v6: hardware, install, the YouTube domains to deny, per-child groups, and the Chromecast and secure DNS catches.
Yes, Pi-hole can block YouTube on every device on your home network, smart TVs and consoles included. You install it on a Raspberry Pi or spare computer, add the YouTube domains to its Denylist, and point your router's DNS at it. It's free software with no query limits, but it takes an hour or so and some comfort with a terminal.
Advanced guide - less technical? Start with NextDNS
This guide is for users comfortable with a command line and basic networking. If that sounds daunting, start with the NextDNS guide instead - it achieves very similar results with a 10-minute setup and no hardware required.
What Is Pi-hole?
Pi-hole is a self-hosted DNS sinkhole - a small server you run on your own network. When any device asks "what's the IP address for youtube.com?", Pi-hole intercepts the question and answers with nothing, so the device never gets YouTube's real IP address.
This works network-wide: every phone, tablet, TV, games console, and laptop on your Wi-Fi is covered by a single configuration. You don't touch each device individually.
Advantages over hosted DNS services (CleanBrowsing, NextDNS):
- Full local control - no data leaves your home to a third-party DNS server
- Zero ongoing cost after initial hardware purchase
- Per-device statistics in the dashboard - you can see which device tried to reach YouTube and exactly when
- Blocks ads as a side effect across the whole network
- Unlimited queries, no tier limits
The trade-off: you maintain it. Pi-hole needs occasional updates, and if the hardware loses power, DNS stops working for everyone on your network.
Hardware Options
Option 1: Raspberry Pi (Recommended)
The Raspberry Pi is the classic Pi-hole host. Three viable models:
- Raspberry Pi Zero 2 W (~$15) - smallest and cheapest. Plenty of power for DNS. Wi-Fi only (no Ethernet port without adapter). Good choice if you want to hide it behind your router.
- Raspberry Pi 3 Model B+ (~$35) - has Ethernet, quad-core, still very low power draw. The most commonly recommended option for Pi-hole.
- Raspberry Pi 4 2GB (~$45) - overkill for Pi-hole alone but good if you want to run other services on the same Pi.
You also need: a microSD card (8GB minimum, Class 10, ~$8), the appropriate power supply for your Pi model, and optionally a case.
Option 2: Docker on Existing Home Server or NAS
If you already run a home server, NAS (Synology, QNAP), or any always-on Linux machine, you can run Pi-hole as a Docker container. Requirements: Docker installed, the machine has a static IP address on your network.
Option 3: Dedicated x86 Machine
Any old PC or mini PC running Ubuntu Server works well. A low-power Intel NUC or similar mini PC makes a capable always-on Pi-hole host.
Installation: Raspberry Pi Method
Step 1: Install Raspberry Pi OS Lite
Download Raspberry Pi Imager
Download Raspberry Pi Imager from raspberrypi.com/software. Install and open it.
Flash the OS to your SD card
In the Imager: select your Pi model, choose "Raspberry Pi OS Lite (64-bit)" as the operating system, and select your microSD card as storage. Before clicking Write, click the gear/settings icon to pre-configure: enable SSH, set a username and password, and configure your Wi-Fi network name and password. This saves you connecting a keyboard and monitor.
First boot
Insert the SD card into your Pi, connect power, and wait about 90 seconds for the first boot to complete.
SSH into the Pi
From another computer on the same network, connect using ssh yourusername@raspberrypi.local (replacing yourusername with what you set in step 2). If the hostname raspberrypi.local doesn't resolve, log into your router's DHCP table to find the Pi's IP address, then SSH to that IP directly.
Update the OS
Run sudo apt update followed by sudo apt upgrade -y to bring the system fully up to date before installing Pi-hole.
Step 2: Install Pi-hole
Run the Pi-hole installer
Pi-hole provides an official one-line install script. Visit pi-hole.net/install for the current install command - it's a single curl command that downloads and runs the installer. The installer is interactive and walks you through configuration.
Choose upstream DNS
During installation you'll choose which upstream DNS server Pi-hole uses for legitimate queries. Cloudflare (1.1.1.1) is recommended for privacy. Avoid Google (8.8.8.8) if privacy is a concern.
Enable the web admin interface
Accept the option to install the web admin dashboard. Once installed, the dashboard is accessible at http://[pi-ip]/admin or http://pi.hole/admin.
Note your admin password
The installer shows an admin password at the end. Note it immediately. In Pi-hole v6 you change it with pihole setpassword (the old pihole -a -p command was removed) (Pi-hole command docs).
Assign a static IP to the Pi
Pi-hole must have a fixed IP - if its IP changes, your router's DNS settings will break. The cleanest method is to reserve the Pi's MAC address in your router's DHCP settings (look for "DHCP Reservation" or "Static DHCP"). You can also set a static IP on the Pi itself, but router-side reservation is easier to manage.
Step 3: Add YouTube Blocklists
Open the Pi-hole admin dashboard
Navigate to http://[pi-ip]/admin in a browser. Log in with your admin password.
Add YouTube domains to the Denylist
In v6, go to Domains in the sidebar, choose Deny (older v5 dashboards called this Blacklist), and add each domain. Tick the option to add it as a wildcard so subdomains are caught too. From the terminal, pihole deny youtube.com does the same job.
youtube.comwww.youtube.comm.youtube.comyoutu.bemusic.youtube.comgooglevideo.com- essential: this is YouTube's video delivery CDN. Without it, the YouTube site may appear to load while videos still play.ytimg.com- thumbnail CDNyt3.ggpht.com- avatar/channel art CDNyoutubei.googleapis.com- YouTube's internal APIyoutube-ui.l.google.comwide-youtube.l.google.com
Add a community YouTube blocklist
Community-maintained blocklists catch YouTube domains that individual entries miss. Search GitHub for "pi-hole youtube blocklist" to find currently maintained lists. In v6, go to Lists โ paste the raw URL of the list โ Add blocklist. Check when it was last updated before you trust it.
Update Gravity
After adding adlists, you must rebuild Pi-hole's database. Go to Tools โ Update Gravity in the dashboard, or run pihole -g in the terminal. This pulls the adlists and builds the block database.
Installation: Docker Method
Create a docker-compose.yml file on your server with the following configuration (described in prose to avoid MDX parsing issues with code blocks):
Define a service named pihole using the pihole/pihole:latest image. Map port 53 (TCP and UDP) on the host to port 53 in the container for DNS, and port 80 for the web admin interface. Set TZ to your timezone (e.g. Australia/Melbourne) and, for v6, set the admin password with FTLCONF_webserver_api_password (the old WEBPASSWORD variable is from v5). Mount a volume for /etc/pihole. The /etc/dnsmasq.d volume is now optional and only needed for custom dnsmasq files. Add restart: unless-stopped so Pi-hole comes back after a reboot. The current example file is in the Pi-hole Docker docs.
Start Pi-hole with docker compose up -d. Access the admin dashboard at http://[server-ip]/admin. Add YouTube domains to the Denylist using the same process described in the Raspberry Pi method above.
Step 4: Point Your Network DNS to Pi-hole
Method A: Configure Router DNS (Recommended)
Log into your router admin panel
See the generic router guide for instructions. Common addresses: 192.168.0.1 or 192.168.1.1.
Find DNS settings
Under WAN settings, Internet Setup, or DHCP settings depending on your router brand.
Set Primary DNS to Pi's static IP
Enter Pi-hole's IP address (e.g. 192.168.1.200) as the Primary DNS. Leave Secondary DNS blank.
Setting a fallback DNS (like 8.8.8.8) means that if Pi-hole is unavailable, devices automatically fall back to Google DNS - and YouTube loads freely. Leave it blank for strict blocking. Accept that Pi-hole downtime will mean no internet for those devices until Pi-hole recovers.
Restart router
Save settings and restart. All devices renewing their DHCP lease will begin using Pi-hole.
Method B: Pi-hole as DHCP Server
Disable DHCP on your router and let Pi-hole serve DHCP instead. This gives Pi-hole full visibility into per-device hostnames (you'll see "Emma's iPhone" in logs rather than an IP address). More advanced, not required for basic YouTube blocking.
Known Gotchas
Blocking googlevideo.com affects Chromecast
googlevideo.com is YouTube's video delivery CDN - you must block it or YouTube loads but videos play anyway. However, Chromecast uses googlevideo.com for all media delivery, including non-YouTube casting (Netflix, Spotify, etc.). Blocking it breaks Chromecast entirely.
Workaround: use Group Management. Put your kids' devices in a "Kids" group and assign the YouTube deny entries only to that group, leaving the Chromecast (and your own devices) in the Default group without them. You'll need a DHCP reservation for each device so Pi-hole recognises it.
googlevideo.com blocking also breaks Google Search video preview thumbnails (minor) and YouTube Shorts embeds in third-party apps.
Blocking ytimg.com affects Google image search thumbnails
Blocking ytimg.com (YouTube's thumbnail CDN) occasionally causes broken image thumbnails in Google image search results. This is a minor cosmetic issue and doesn't affect Google Search functionality otherwise.
Pi-hole downtime = no internet for all devices
If the Pi loses power or crashes, all devices using it as their only DNS server appear to lose internet access. DNS stops resolving entirely.
Mitigation: set a backup DNS (8.8.8.8) on your own devices only - not child devices. On child devices, no secondary DNS means downtime actually enforces stricter blocking (no internet at all until Pi-hole recovers). This is often acceptable for the target use case.
How Kids Bypass This
Changing DNS on device: Tech-savvy users can open their device's network settings and switch to Google DNS (8.8.8.8). On iPhone, lock this via Screen Time โ Settings โ Content & Privacy Restrictions โ prevent VPN and device management changes. On Android, Family Link restricts DNS changes.
Mobile data: Pi-hole only works on your home network. When a phone is on 4G/5G, it uses its carrier's DNS entirely. Pair Pi-hole with Screen Time (iPhone) or Family Link (Android) for mobile data coverage.
VPN apps: Any VPN completely bypasses Pi-hole by routing traffic through an encrypted tunnel. Block VPN app installation at the device level using Screen Time or Family Link.
Admin dashboard access: Anyone who knows the Pi-hole admin password can allow youtube.com in seconds, or hit the Disable blocking button. Keep the password secret, and don't leave the dashboard logged in on a family computer.
Browser secure DNS: Chrome, Edge and Firefox can use DNS over HTTPS and go straight past Pi-hole. Turn off Use secure DNS in Chrome (Settings โ Privacy and security โ Security) and DNS over HTTPS in Firefox (Settings โ Privacy & Security). Pi-hole blocks Firefox's canary domain use-application-dns.net by default, which stops Firefox switching DoH on automatically, but not if someone turns it on by hand (Mozilla).
Counter-Measures
Block port 53 outbound on router: Prevents devices from manually switching their DNS to 8.8.8.8. Routers with firewall rules (ASUS with Merlin firmware, Ubiquiti UniFi, pfSense, OPNsense) can block all outbound port 53 traffic except to Pi-hole's IP. This is the single most effective hardening step.
Per-device statistics: Pi-hole's dashboard shows exactly which device attempted to reach blocked YouTube domains and when. Useful for identifying bypass attempts - a sudden spike in blocked queries from one device is a signal.
Keep Pi-hole updated: Run pihole -up to update Pi-hole itself. Run sudo apt update && sudo apt upgrade to update the underlying OS. Monthly maintenance is sufficient.
Pair with device-level controls for mobile data: Pi-hole covers your home network comprehensively, but devices on mobile data bypass it entirely. Screen Time (iPhone) and Family Link (Android) fill this gap. Both together create strong cross-context coverage.
Related Guides
Block YouTube with DNS Filtering on Your Home Wi-Fi
Which DNS filters actually block YouTube (most free ones don't), how to set one on your router, and how to stop kids bypassing it with secure DNS or a VPN.
By MethodBlock YouTube with NextDNS: Router and Device Setup
Block YouTube on every device with NextDNS: one-tap Parental Control block, router and phone setup, the free 300k query limit, and stopping secure DNS bypasses.
By MethodBlock YouTube with OpenDNS Home (Free, Whole Network)
FamilyShield won't block YouTube. Here's how to block it free with an OpenDNS Home account, keep your IP updated, and stop kids bypassing it with secure DNS.
By MethodHow to Block YouTube with Firewalla (App Rule Guide)
Block YouTube on chosen devices or your whole network with a Firewalla app rule. Current models and prices, which mode to use, schedules and bypass gaps.
Want a personalised plan?
Answer 5 questions and get a guide for every device your child uses.
Take the Quiz โ