Skip to content Skip to sidebar Skip to footer

How to Block TikTok Ads with Pi-hole on Raspberry Pi

Hi online friends, If you are annoyed by the intrusive and annoying ads on TikTok, you might be interested in a simple and effective solution: Pi-hole. Pi-hole is a network-wide ad blocker that allows you to block ads on all devices connected to your network. In this article, we will explain what Pi-hole is, how it works, and how to install it on a Raspberry Pi.

What is Pi-hole?

Pi-hole is a free and open source software that acts as a DNS server for your network. DNS stands for Domain Name System, which is the service that translates domain names (such as into IP addresses (such as When you type a domain name in your browser, your device sends a DNS query to a DNS server, which responds with the IP address of the website you want to visit.

Pi-hole intercepts these DNS queries and checks them against a list of domains that are known to serve ads or trackers. If the domain is on the list, Pi-hole returns a fake IP address (such as instead of the real one, effectively blocking the ad or tracker from loading. If the domain is not on the list, Pi-hole forwards the query to an upstream DNS server (such as Google DNS or Cloudflare DNS) and returns the real IP address.

By blocking ads and trackers at the DNS level, Pi-hole can improve your network performance, privacy, and security. You can also customize your blocklists, whitelist domains that you want to allow, and view detailed statistics and logs of your network activity.

Why use Pi-hole to block TikTok ads?

TikTok is one of the most popular social media apps in the world, with over 1 billion monthly active users. However, it is also notorious for its aggressive and intrusive advertising practices. TikTok shows ads in various formats, such as:

- In-feed ads: These are video ads that appear in between user-generated content in your feed.

- Brand takeover ads: These are full-screen video or image ads that appear when you open the app or switch between categories.

- TopView ads: These are similar to brand takeover ads, but they last up to 60 seconds and have sound.

- Hashtag challenge ads: These are sponsored hashtags that encourage users to create and share content related to a brand or product.

- Branded effects ads: These are custom filters, stickers, or lenses that users can apply to their videos to promote a brand or product.

These ads can be annoying, distracting, and sometimes inappropriate for some audiences. They can also consume a lot of bandwidth and battery life on your device. Moreover, TikTok collects a lot of personal data from its users, such as:

- Device information: Such as device model, operating system, screen resolution, IP address, MAC address, IMEI number, etc.

- Usage information: Such as app usage time, app settings, preferences, interactions with other users, etc.

- Location information: Such as GPS data, Wi-Fi access points, cell towers, etc.

- Camera and microphone information: Such as images, videos, audio recordings, etc.

- Contact information: Such as phone number, email address, contacts list, etc.

- Social network information: Such as Facebook ID, Twitter ID, Instagram ID, etc.

TikTok uses this data to target ads based on your interests, behavior, and location. It also shares this data with third-party advertisers and partners who may use it for their own purposes.

By using Pi-hole to block TikTok ads, you can enjoy a cleaner and smoother experience on the app without being bombarded by unwanted ads. You can also reduce the amount of data that TikTok collects and shares with others.

How to install Pi-hole on Raspberry Pi?

Raspberry Pi is a small and affordable computer that can run various operating systems and applications. It is ideal for running Pi-hole because it is low-power, easy to set up, and can handle multiple devices on your network.

To install Pi-hole on Raspberry Pi, you will need:

- A Raspberry Pi with Ethernet

- A microSD card (at least 8 GB)

- A power supply for your Raspberry Pi

- An Ethernet cable for your Raspberry Pi

- A Windows PC

The steps are as follows:

1. Download and install Raspberry Pi Imager from the Raspberry Pi website.

2. Insert a spare microSD card into your computer. Note that this card will be erased.

3. Launch Raspberry Pi Imager and press SHIFT + CTRL + X to open a secret configuration menu.

4. Scroll down and click on Enable SSH and then set a new SSH password. Click Save when done.

5. Under Operating System select Raspberry Pi OS (32-bit).

6. Under Storage click on the button and select the microSD card. Double check that you have the right drive before proceeding.

7. Click on Write to download and write Raspberry Pi OS to the microSD card. When done remove the card from your computer.

8. Insert the Raspberry Pi OS microSD card into your Raspberry Pi. Then connect your Raspberry Pi to the network via an Ethernet cable and finally connect power to boot the Raspberry Pi.

9. Windows users, download and install PuTTY. Linux and Mac users can directly open a terminal.

10. Via PuTTY enter the hostname as raspberrypi.local (on some networks, this is just raspberrypi without the .local) and then click Open.

11. Enter the username as pi and the password as raspberry (or the one you set in step 4).

12. Type sudo apt update && sudo apt upgrade -y to update your Raspberry Pi OS.

13. Type curl -sSL | bash to download and run the Pi-hole installation script.

14. Follow the on-screen instructions to configure Pi-hole. You can accept the default settings or customize them according to your preferences.

15. When the installation is complete, you will see a confirmation message with your Pi-hole web interface password and IP address. Note them down for future reference.

How to block TikTok ads with Pi-hole?

To block TikTok ads with Pi-hole, you need to add some domains to your blocklist that are known to serve ads or trackers for TikTok. You can find these domains from various sources, such as:

- Reddit: There are several posts on r/pihole that share blocklists for TikTok, such as this one or this one.

- GitHub: There are some repositories that host blocklists for TikTok, such as this one or this one.

- PiPiADS: This is a website that provides curated blocklists for various apps and websites, including TikTok.

You can choose any of these sources or use a combination of them to create your own blocklist. To add domains to your blocklist, you need to:

1. Log in to your Pi-hole web interface using your IP address and password (e.g.,

2. Go to Group Management > Adlists.

3. Click on Add a new adlist.

4. Enter the URL of the blocklist you want to add (e.g.,

5. Click on Add.

6. Repeat steps 3-5 for any other blocklists you want to add.

7. Go to Tools > Update Gravity.

8. Click on Update to apply the changes.

Alternatively, you can also add domains manually by editing the /etc/pihole/adlists.list file on your Raspberry Pi via SSH or FTP.

Once you have added the domains to your blocklist, you need to point your devices to use Pi-hole as their DNS server. There are two ways to do this:

- Router level: This is the recommended way because it will apply Pi-hole to all devices on your network automatically. To do this, you need to log in to your router's web interface and change its DNS settings to use your Pi-hole's IP address as the primary DNS server and leave the secondary DNS server blank or use a public DNS server (such as or The exact steps may vary depending on your router model and firmware, so refer to your router's manual or website for more details.

- Device level: This is an alternative way if you only want to use Pi-hole on specific devices or if you cannot access your router's web interface. To do this, you need to go to your device's network settings and change its DNS settings to use your Pi-hole's IP address as the primary DNS server and leave the secondary DNS server blank or use a public DNS server (such as or The exact steps may vary depending on your device's operating system and version, so refer to your device's manual or website for more details.

After changing your DNS settings, you may need to restart your device or clear its DNS cache for the changes to take effect.

How to test if Pi-hole is blocking TikTok ads?

To test if Pi-hole is blocking TikTok ads, you can do the following:

- Open TikTok on your device and browse through some videos and categories. You should not see any ads in between or before the videos.

- Go to your Pi-hole web interface and check the dashboard and query log for any blocked domains related to TikTok (such as,,, etc.). You should see some green entries indicating that Pi-hole has blocked them.

- Go to Tools- Go to Tools > Tail pihole.log and watch the live output of Pi-hole's activity. You should see some lines with the word "blocked" and the domains related to TikTok.

If you see these results, congratulations! You have successfully blocked TikTok ads with Pi-hole on Raspberry Pi. You can now enjoy a cleaner and smoother experience on the app without being bothered by unwanted ads.


In this article, we have explained what Pi-hole is, how it works, and how to install it on a Raspberry Pi. We have also shown you how to block TikTok ads with Pi-hole by adding some domains to your blocklist and changing your DNS settings. We hope you have found this article useful and informative. If you have any questions or feedback, please feel free to leave a comment below.

Video Reference about : How to Block TikTok Ads with Pi-hole on Raspberry Pi

Post a Comment for "How to Block TikTok Ads with Pi-hole on Raspberry Pi"