YouTube ad-serving domain blocklist for Pi-hole (v5 & v6), AdGuard Home, pfBlockerNG and other DNS blockers - add one URL and block YouTube ads on every device on your network. Updated daily.
See the codeA community-maintained list of YouTube ad-serving domains β add one link to Pi-hole and you're done.
Last updated: Oct 8th 2026 - 15,929 domains in the list - works with Pi-hole v5 and v6, AdGuard Home, pfBlockerNG, Technitium and any other DNS blocker that accepts a hosts-style domain list.
The easiest way β nothing to install. Pi-hole downloads the list itself and refreshes it every time gravity updates.
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/refs/heads/master/youtubelist.txt
pihole -g
That's it. Pi-hole re-downloads the list on every gravity update (weekly by default β run pihole -g any time to get the latest version sooner). The published list already excludes everything in ignore.list, so videos keep playing.
π‘ Using Pi-hole's default blocklist (StevenBlack hosts)? It blocks
s.youtube.com, which breaks video playback. Allow it once:pihole allow s.youtube.com # Pi-hole v6 pihole -w s.youtube.com # Pi-hole v5
Prefer to have every domain as an exact entry in your denylist (visible under Domains in the web interface), add your own never-block entries, or pick up new domains every hour instead of at the next gravity update? Use youtube.sh.
Every time it runs it:
black.list from this repo,ignore.list (so videos keep playing),It works with Pi-hole v5 and v6, needs nothing beyond what Pi-hole already installs, and re-runs itself with sudo if you forget.
git clone https://github.com/kboghdady/youTube_ads_4_pi-hole.git
cd youTube_ads_4_pi-hole
sudo ./youtube.sh
You should see something like:
YouTube ads blocker for Pi-hole v6
[i] Downloading the latest YouTube ad list...
[+] 15855 domains in the list (0 skipped because of ignore.list)
[i] Adding 15855 new domain(s) to the denylist...
[i] This takes a few minutes the first time - later runs only add what is new
................................................................................
[+] Added 15855 domain(s)
[i] Reloading Pi-hole's lists...
[+] Shared 12 googlevideo.com hostname(s) from your query log - thank you!
[+] All done. Pi-hole is blocking 15855 YouTube ad domains.
Add the script to root's crontab so it picks up new domains on its own:
sudo crontab -e
Add this line to run it every hour (change the path if you cloned somewhere else):
0 * * * * /home/pi/youTube_ads_4_pi-hole/youtube.sh > /dev/null 2>&1
Tip: crontab.guru explains the schedule syntax if you'd like a different interval.
| Option | What it does |
|---|---|
--dry-run | Show what would change without touching Pi-hole β great for a first look |
--no-share | Don't send googlevideo.com hostnames from your query log (see Privacy) |
--crowd | Also block the unfiltered crowd list (see The crowd list) |
-h, --help | Show the help text |
The same settings live at the top of youtube.sh if you'd rather change them permanently.
To add your own never-block entries, put them in the ignore.list next to the script (one per line β a full hostname or just a part of it, such as n4v7sne7). Your entries are merged with the latest ignore.list from this repo on every run.
youtubelist.txt is a plain list of hostnames, one per line, so it works with any DNS-level ad blocker that can subscribe to a domain list β not only Pi-hole. Use the same address everywhere:
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/refs/heads/master/youtubelist.txt
| Blocker | Where to add it |
|---|---|
| AdGuard Home | Filters β DNS blocklists β Add blocklist β Add a custom list, paste the URL |
| pfBlockerNG (pfSense) | Firewall β pfBlockerNG β DNSBL β DNSBL Groups, add a feed with the URL (format Auto) |
| Technitium DNS | Settings β Blocking β Block List URLs, add the URL |
| Blocky | Add the URL under blocking.denylists in config.yml |
| OPNsense Unbound | Services β Unbound DNS β Blocklist, add it as a custom blocklist URL |
Whatever you use, keep s.youtube.com and the hostnames in ignore.list allowed β they are needed for videos to play.
It does
It doesn't
googlevideo.com domains and rotates them constantly; some ads will always slip through, and new hostnames take a day or two to reach the list.For the best result, use this list on your DNS blocker and a browser extension on the devices where you can install one.
YouTube serves ads and videos from the same family of domains (*.googlevideo.com), so a normal blocklist can't tell them apart. This project keeps a curated list of the hostnames that only serve ads, and an ignore.list of the ones that break video playback. Both published lists are filtered against ignore.list before every update.
| File | What it is |
|---|---|
youtubelist.txt | The list to add to Pi-hole (Option 1) |
black.list | The same list, downloaded by youtube.sh (Option 2) |
ignore.list | Hostnames (or parts of them) that must never be blocked because they break videos |
crowed_list.txt | Raw, unfiltered domains gathered from the community β see The crowd list |
youtube.sh | The script behind Option 2 |
The list is refreshed every day or two.
crowed_list.txt contains every googlevideo.com hostname reported by users of the script β including the ones that serve videos. It blocks more ads but is far more likely to break playback.
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/refs/heads/master/crowed_list.txtsudo ./youtube.sh --crowd (or set INCLUDE_CROWD_LIST=true at the top of the script)Only use it if you know how to find and allow a blocked hostname in Pi-hole's query log.
s.youtube.com isn't blocked. Pi-hole's default list (StevenBlack hosts) includes it, and blocking it breaks playback:
pihole allow s.youtube.com # Pi-hole v6
pihole -w s.youtube.com # Pi-hole v5
pihole -g (Option 1) or sudo ./youtube.sh (Option 2) β the hostname may already have been removed from the list.r?---sn-xxxxxxx.googlevideo.com entry. Allow it in Pi-hole, then please open an issue or a pull request adding the sn-xxxxxxx part to ignore.list so everyone benefits. Script users can also add it to their local ignore.list and run sudo ./youtube.sh again β it removes the domain from the denylist for you.pihole-FTL sqlite3 /etc/pihole/gravity.db "DELETE FROM domainlist WHERE type = 1 AND domain LIKE '%googlevideo.com';"
pihole reloadlists # Pi-hole v6
pihole restartdns reload-lists # Pi-hole v5
If you also want the other ad domains gone (doubleclick.net, googlesyndication.com, β¦), delete by the comment the script writes instead:
pihole-FTL sqlite3 /etc/pihole/gravity.db "DELETE FROM domainlist WHERE comment = 'YouTube ads (youtube.sh)';"
The script has to run on the machine (or in the container) where Pi-hole is installed β it talks to Pi-hole through the pihole command. If Pi-hole runs in Docker, use Option 1 instead.
sudo crontab -e), not your user's./home/pi/youTube_ads_4_pi-hole/youtube.sh.sudo ./youtube.sh to see any error messages.Option 1 sends nothing anywhere β Pi-hole just downloads a text file from GitHub.
To keep the list up to date, the script (Option 2) shares the googlevideo.com hostnames that your Pi-hole has seen in the last 24 hours. That's all it sends β no IP addresses, no client names, no other domains. The hostnames are collected through a Google Form and reviewed before anything is added to the list.
Don't want to share? Run the script with --no-share, or set SHARE_LOGS=false at the top of youtube.sh. Everything else works exactly the same.
youtubelist.txt and black.list β or run the script with log sharing on and it will reach the list.ignore.list.Keeping the list current takes daily work. If it saves you from a few ads, consider buying me a coffee:
| Coin | Address |
|---|---|
| Bitcoin | 36fD957SDWHJYYzuH2xmceJ6T2qE9vNiV4 |
| XRP | rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg |
Thank you! π
827 followers Β· starred Aug 2019
155 followers Β· starred Mar 2024
477 followers Β· starred Aug 2020
15 followers Β· starred Jun 2020
YouTube ad-serving domain blocklist for Pi-hole (v5 & v6), AdGuard Home, pfBlockerNG and other DNS blockers - add one URL and block YouTube ads on every device on your network. Updated daily.
See the codeA community-maintained list of YouTube ad-serving domains β add one link to Pi-hole and you're done.
Last updated: Oct 8th 2026 - 15,929 domains in the list - works with Pi-hole v5 and v6, AdGuard Home, pfBlockerNG, Technitium and any other DNS blocker that accepts a hosts-style domain list.
The easiest way β nothing to install. Pi-hole downloads the list itself and refreshes it every time gravity updates.
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/refs/heads/master/youtubelist.txt
pihole -g
That's it. Pi-hole re-downloads the list on every gravity update (weekly by default β run pihole -g any time to get the latest version sooner). The published list already excludes everything in ignore.list, so videos keep playing.
π‘ Using Pi-hole's default blocklist (StevenBlack hosts)? It blocks
s.youtube.com, which breaks video playback. Allow it once:pihole allow s.youtube.com # Pi-hole v6 pihole -w s.youtube.com # Pi-hole v5
Prefer to have every domain as an exact entry in your denylist (visible under Domains in the web interface), add your own never-block entries, or pick up new domains every hour instead of at the next gravity update? Use youtube.sh.
Every time it runs it:
black.list from this repo,ignore.list (so videos keep playing),It works with Pi-hole v5 and v6, needs nothing beyond what Pi-hole already installs, and re-runs itself with sudo if you forget.
git clone https://github.com/kboghdady/youTube_ads_4_pi-hole.git
cd youTube_ads_4_pi-hole
sudo ./youtube.sh
You should see something like:
YouTube ads blocker for Pi-hole v6
[i] Downloading the latest YouTube ad list...
[+] 15855 domains in the list (0 skipped because of ignore.list)
[i] Adding 15855 new domain(s) to the denylist...
[i] This takes a few minutes the first time - later runs only add what is new
................................................................................
[+] Added 15855 domain(s)
[i] Reloading Pi-hole's lists...
[+] Shared 12 googlevideo.com hostname(s) from your query log - thank you!
[+] All done. Pi-hole is blocking 15855 YouTube ad domains.
Add the script to root's crontab so it picks up new domains on its own:
sudo crontab -e
Add this line to run it every hour (change the path if you cloned somewhere else):
0 * * * * /home/pi/youTube_ads_4_pi-hole/youtube.sh > /dev/null 2>&1
Tip: crontab.guru explains the schedule syntax if you'd like a different interval.
| Option | What it does |
|---|---|
--dry-run | Show what would change without touching Pi-hole β great for a first look |
--no-share | Don't send googlevideo.com hostnames from your query log (see Privacy) |
--crowd | Also block the unfiltered crowd list (see The crowd list) |
-h, --help | Show the help text |
The same settings live at the top of youtube.sh if you'd rather change them permanently.
To add your own never-block entries, put them in the ignore.list next to the script (one per line β a full hostname or just a part of it, such as n4v7sne7). Your entries are merged with the latest ignore.list from this repo on every run.
youtubelist.txt is a plain list of hostnames, one per line, so it works with any DNS-level ad blocker that can subscribe to a domain list β not only Pi-hole. Use the same address everywhere:
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/refs/heads/master/youtubelist.txt
| Blocker | Where to add it |
|---|---|
| AdGuard Home | Filters β DNS blocklists β Add blocklist β Add a custom list, paste the URL |
| pfBlockerNG (pfSense) | Firewall β pfBlockerNG β DNSBL β DNSBL Groups, add a feed with the URL (format Auto) |
| Technitium DNS | Settings β Blocking β Block List URLs, add the URL |
| Blocky | Add the URL under blocking.denylists in config.yml |
| OPNsense Unbound | Services β Unbound DNS β Blocklist, add it as a custom blocklist URL |
Whatever you use, keep s.youtube.com and the hostnames in ignore.list allowed β they are needed for videos to play.
It does
It doesn't
googlevideo.com domains and rotates them constantly; some ads will always slip through, and new hostnames take a day or two to reach the list.For the best result, use this list on your DNS blocker and a browser extension on the devices where you can install one.
YouTube serves ads and videos from the same family of domains (*.googlevideo.com), so a normal blocklist can't tell them apart. This project keeps a curated list of the hostnames that only serve ads, and an ignore.list of the ones that break video playback. Both published lists are filtered against ignore.list before every update.
| File | What it is |
|---|---|
youtubelist.txt | The list to add to Pi-hole (Option 1) |
black.list | The same list, downloaded by youtube.sh (Option 2) |
ignore.list | Hostnames (or parts of them) that must never be blocked because they break videos |
crowed_list.txt | Raw, unfiltered domains gathered from the community β see The crowd list |
youtube.sh | The script behind Option 2 |
The list is refreshed every day or two.
crowed_list.txt contains every googlevideo.com hostname reported by users of the script β including the ones that serve videos. It blocks more ads but is far more likely to break playback.
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/refs/heads/master/crowed_list.txtsudo ./youtube.sh --crowd (or set INCLUDE_CROWD_LIST=true at the top of the script)Only use it if you know how to find and allow a blocked hostname in Pi-hole's query log.
s.youtube.com isn't blocked. Pi-hole's default list (StevenBlack hosts) includes it, and blocking it breaks playback:
pihole allow s.youtube.com # Pi-hole v6
pihole -w s.youtube.com # Pi-hole v5
pihole -g (Option 1) or sudo ./youtube.sh (Option 2) β the hostname may already have been removed from the list.r?---sn-xxxxxxx.googlevideo.com entry. Allow it in Pi-hole, then please open an issue or a pull request adding the sn-xxxxxxx part to ignore.list so everyone benefits. Script users can also add it to their local ignore.list and run sudo ./youtube.sh again β it removes the domain from the denylist for you.pihole-FTL sqlite3 /etc/pihole/gravity.db "DELETE FROM domainlist WHERE type = 1 AND domain LIKE '%googlevideo.com';"
pihole reloadlists # Pi-hole v6
pihole restartdns reload-lists # Pi-hole v5
If you also want the other ad domains gone (doubleclick.net, googlesyndication.com, β¦), delete by the comment the script writes instead:
pihole-FTL sqlite3 /etc/pihole/gravity.db "DELETE FROM domainlist WHERE comment = 'YouTube ads (youtube.sh)';"
The script has to run on the machine (or in the container) where Pi-hole is installed β it talks to Pi-hole through the pihole command. If Pi-hole runs in Docker, use Option 1 instead.
sudo crontab -e), not your user's./home/pi/youTube_ads_4_pi-hole/youtube.sh.sudo ./youtube.sh to see any error messages.Option 1 sends nothing anywhere β Pi-hole just downloads a text file from GitHub.
To keep the list up to date, the script (Option 2) shares the googlevideo.com hostnames that your Pi-hole has seen in the last 24 hours. That's all it sends β no IP addresses, no client names, no other domains. The hostnames are collected through a Google Form and reviewed before anything is added to the list.
Don't want to share? Run the script with --no-share, or set SHARE_LOGS=false at the top of youtube.sh. Everything else works exactly the same.
youtubelist.txt and black.list β or run the script with log sharing on and it will reach the list.ignore.list.Keeping the list current takes daily work. If it saves you from a few ads, consider buying me a coffee:
| Coin | Address |
|---|---|
| Bitcoin | 36fD957SDWHJYYzuH2xmceJ6T2qE9vNiV4 |
| XRP | rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg |
Thank you! π
827 followers Β· starred Aug 2019
155 followers Β· starred Mar 2024
477 followers Β· starred Aug 2020
15 followers Β· starred Jun 2020