Updated . Posted
When you request a website, your domain name server (DNS) translates a domain name into an IP address, like this:
duckduckgo.com -> 184.108.40.206
Every network has a default DNS, but you should use one that improves your privacy and blocks ads. There are many choices, some available by changing your settings, and some that require an app.
I used Adguard’s free DNS for about 2.5 years, and it's the easiest way to block ads without using any software. In your system settings, replace the wifi's default DNS with these Adguard servers (either or both will suffice):
These following options list other methods, to better control your device, as well as filter your cellular data, by using an app.
Some Androids won't let you change your DNS settings, and you need an app. I'd go with NextDNS, or look for other dns changer apps, such as dnspipe, or Hosts Go. You could try a 7 day trial for Adguard's Android app, and then pay if you like it. There are good reasons to run their software on your phone, compared to relying on an external DNS like NextDNS, but you'll have to decide for yourself.
If you're manually editing a wifi network, to copy/paste those Adguard servers (or any other server), here's the process:
Settings > Wifi > (Network Name) > Configure DNS > Manual > Add Server > (paste Servers above)
This can be tedious if you use many different networks, because you'll have to change each one. However, apps like NextDNS, or Adguard Pro give you far more control over your phone, which is better for privacy, and they work for all networks, If you want a free option with a local filter/firewall, DNSCloak has more features than Adguard but is much harder to use. I haven't tried Shadowrocket, but it seems like the most powerful option and also easier to use than DNSCloak. It's $3, and if knowing what I know today, I would probably buy Shadowrocket for filtering directly on my phone, and then use NextDNS as a secondary filter. I already paid $2 for Adguard Pro, so I'm not going to buy a similar app.
In April 2020 I switched from Adguard to NextDNS, because their service offers more features and works more easily on other devices. It's free for normal usage, up to 300,000 queries/month, and then only $2/month for unlimited service if you need it. NextDNS has a great website for creating filters and visualizing your traffic. It sorts by common domains and shows you what has been blocked. It's like the Pi-Hole project, but significantly easier to use.
Stan Lange wrote a very detailed review of NextDNS, which inspired my switch. I'll update my post if I have anything useful to share, since I'm relatively new to their service, but his article is excellent and covers everything already.
However, I still recommend Adguard for the quickest solution, provided you don't need to install apps that change your DNS. For a convenient and powerful tool, NextDNS absolutely is the way to go. Adguard's iOS app still provides value as a Safari a content-blocker, or a local DNS firewall. This lets you block traffic before it leaves your phone, which reduces wifi congestion.
If you want to block ads on your cellular network, you'll need an app, which creates a VPN to answer DNS queries. Whether you buy an app or find a free one, the value is amazing, even for $2/month. Your cellular service and wifi probably cost over $100/month anyway.
How DNS Blocking Works
A domain name server converts a domain name into an IP address, like this:
Your phone connects to the given IP address, and the DNS can block sites by refusing connections, and giving your phone the address
0.0.0.0 instead. As an example, Snapchat sends messages with
app.snapchat.com, but they download ads from
snap-ads.snapchat.com. Block that one, and you won't get ads between your friends' stories.
Some apps, like YouTube, use one domain for everything, so you can't block ads with a DNS. It would block the ads and videos together, preventing you from seeing anything. In those instances, just visit the website through a browser, and block ads with a browser extension or content blocker. Mobile apps reduce or eliminate your control, so I recommend using websites whenever possible. This is the only way to watch YouTube videos in the background on a smartphone.
My blacklist is only about 20 rules, which block commonly used patterns, and then I improve my list based on usage. Another approach is to block all traffic with this rule:
Then, you whitelist only allowed sites. This is the most difficult but also most powerful way to improve your privacy. It breaks everything, and it may take a couple hours to whitelist what you need. If you take this approach, you can look at my whitelist below, selecting entries for any apps or websites you want to visit.
graph.* personalization.* location.* typography.* typeface.* tracking.* metrics.* stats.* ads.* pixel.* geo.* geoip.* tag.* tags.* beacon.* track.* tracker.* event.* events.* lytics.* collector.*
I whitelist important websites and apps, and I can always add new rules or disable the blocking. My whitelist is only about 200 entries.
While using apps or visiting common sites, check your network logs, and see what slips past Adguard's filter. Their DNS isn't perfect, and companies are always using new sites to deliver ads. It's a massive arms-race, so I decided to block everything by default and not worry about anything slipping through.
After blocking everything, look at my whitelist to see if you need any particular entries. It should save you some time, since I've already tested them. If there are any errors, please contact me. Once your custom blacklist is good enough, you can switch to a different DNS, like 220.127.116.11, since it's the world's fastest server. Or go with NextDNS.
Whitelist for Categories or Sites
Core Internet Infrastructure
Firefox and Mozilla
Facebook and Instagram
Apple and iCloud