Moderator note:
This post contains scripts, or links to scripts, that are untested by the Pi-hole team.
We encourage users to be creative, but we are unable to support any potential problems caused by running these scripts
To force safe search using Pi-hole just like what AdGuard Home does, run the following commands.
########################################################################################################################################
# Safe Search #
# All records copied from https://github.com/AdguardTeam/AdGuardHome/blob/9f0fdc5e78331a9486c1be2de2d062abff63deb7/internal/filtering/safesearch.go for use with Pi-hole #
########################################################################################################################################
# DuckDuckGo
sudo pihole -a addcustomcname duckduckgo.com safe.duckduckgo.com false
sudo pihole -a addcustomcname www.duckduckgo.com safe.duckduckgo.com false
sudo pihole -a addcustomcname start.duckduckgo.com safe.duckduckgo.com false
# Bing
sudo pihole -a addcustomcname www.bing.com strict.bing.com false
# Google
sudo pihole -a addcustomcname www.google.ad forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ae forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.al forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.am forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.as forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.at forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.az forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ba forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.be forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.bf forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.bg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.bi forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.bj forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.bs forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.bt forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.by forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ca forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cd forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cf forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ch forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ci forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cl forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ao forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.bw forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ck forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.cr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.id forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.il forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.in forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.jp forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ke forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.kr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ls forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ma forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.mz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.nz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.th forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.tz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ug forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.uk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.uz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.ve forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.co.vi forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.af forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ag forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ai forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ar forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.au forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.bd forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.bh forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.bn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.bo forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.br forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.bz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.co forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.cu forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.cy forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.do forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ec forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.eg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.et forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.fj forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.gh forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.gi forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.gt forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.hk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.jm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.kh forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.kw forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.lb forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ly forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.mm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.mt forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.mx forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.my forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.na forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.nf forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ng forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ni forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.np forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.om forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.pa forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.pe forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.pg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ph forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.pk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.pr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.py forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.qa forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.sa forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.sb forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.sg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.sl forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.sv forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.tj forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.tr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.tw forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.ua forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.uy forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.vc forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.com.vn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cv forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.cz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.de forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.dj forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.dk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.dm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.dz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ee forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.es forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.fi forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.fm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.fr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ga forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ge forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.gg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.gl forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.gm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.gp forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.gr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.gy forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.hn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.hr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ht forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.hu forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ie forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.im forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.iq forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.is forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.it forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.je forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.jo forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.kg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ki forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.kz forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.la forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.li forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.lk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.lt forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.lu forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.lv forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.md forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.me forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.mg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.mk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ml forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.mn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ms forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.mu forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.mv forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.mw forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ne forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.nl forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.no forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.nr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.nu forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.pl forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.pn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ps forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.pt forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ro forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.rs forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ru forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.rw forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.sc forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.se forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.sh forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.si forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.sk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.sm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.sn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.so forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.sr forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.st forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.td forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.tg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.tk forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.tl forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.tm forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.tn forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.to forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.tt forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.vg forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.vu forcesafesearch.google.com false
sudo pihole -a addcustomcname www.google.ws forcesafesearch.google.com false
# YouTube
sudo pihole -a addcustomcname m.youtube.com restrictmoderate.youtube.com false
sudo pihole -a addcustomcname www.youtube-nocookie.com restrictmoderate.youtube.com false
sudo pihole -a addcustomcname www.youtube.com restrictmoderate.youtube.com false
sudo pihole -a addcustomcname youtube.googleapis.com restrictmoderate.youtube.com false
sudo pihole -a addcustomcname youtubei.googleapis.com restrictmoderate.youtube.com false
# Pixabay
sudo pihole -a addcustomcname pixabay.com safesearch.pixabay.com false
# Yandex
sudo pihole -a addcustomdns 213.180.193.56 www.yandex.by false
sudo pihole -a addcustomdns 213.180.193.56 www.yandex.com false
sudo pihole -a addcustomdns 213.180.193.56 www.yandex.kz false
sudo pihole -a addcustomdns 213.180.193.56 www.yandex.ru false
sudo pihole -a addcustomdns 213.180.193.56 www.yandex.ua false
sudo pihole -a addcustomdns 213.180.193.56 yandex.by false
sudo pihole -a addcustomdns 213.180.193.56 yandex.com false
sudo pihole -a addcustomdns 213.180.193.56 yandex.kz false
sudo pihole -a addcustomdns 213.180.193.56 yandex.ru false
sudo pihole -a addcustomdns 213.180.193.56 yandex.ua false
# Important! Restart DNS after all the records are added
sudo pihole -a restartdns