Blog

DNS Ad-Blocking

Posted November 6, 2017. Last updated November 24, 2019.

For over two years, I've used Adguard’s free DNS to block ads on my phone and protect my privacy. In system settings, replace your wifi's DNS with these servers:

  • 176.103.130.130
  • 176.103.130.131

If you want to block ads on your cellular network, you'll probably need to install an app, which uses a local vpn to control traffic. For more information, see my post about Online Privacy Tips.

For Android

If you can't modify your wifi settings, you can find free apps to change your DNS, such as dnspipe, or Hosts Go.

For iOS

Settings > Wifi > (Network Name) > Configure DNS > Manual > Add Server > (paste Servers above)

I recommend Adguard Pro, for only $2. DNSCloak is free and very powerful, but somewhat complex. I prefer Adguard Pro, but Shadowrocket is $3 and seems to be the most powerful option, but I haven't tried it out.

How it works

A domain name server (DNS) converts a domain name into an IP address, like this:

news.ycombinator.com –> 209.216.230.240

Your phone connects to the resulting IP address, and the DNS can block sites by refusing connections. As an example, Snapchat sends messages with app.snapchat.com, but they download ads from snap-ads.snapchat.com.

Some apps, like YouTube, use one domain for everything, so you can't block ads with a DNS. You have to use a browser extension or content blocker to block ads. Apps take away your freedom, so I recommend using websites whenever possible.

My blacklist is only about 20 rules, which block all traffic, and then I whitelist only approved sites.

Blacklist
*.*
events.*
personalization.*
location.*
typography.*
typeface.*
tracking.*
metrics.*
stats.*
ads.*
pixel.*
geo.*
geoip.*
tag.*
tags.*
beacon.*
track.*
tracker.*
events.*
event.*
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 1.1.1.1, since it's the world's fastest server.

Download my entire whitelist.txt, or click the lists below.

Snapchat
  • auth.snapchat.com
  • app.snapchat.com
  • chat-gateway-prod.chat.snapchat.com
  • mvm.snapchat.com
  • snap.api.mapbox.com
Core Internet Infrastructure
  • squarespace.com
  • l.google.com
  • cloudflare.com
  • cloudflare.net
  • cloudfront.net
  • azureedge.net
  • polyfill.io
  • fastly.net
  • fastlylb.net
  • bootstrapcdn.com
  • squarecdn.com
  • blogspot.com
  • format.com
  • netlify.com
  • letsencrypt.org
  • digicert.com
  • github.com
  • github.io
  • githubusercontent.com
  • herokuapp.com
  • mapbox.com
  • App Resources
  • onfido.com
Popular Sites
  • wikimedia.org
  • wikipedia.org
  • flickr.com
  • vimeo.com
  • twimg.com
  • twitter.com
  • reddit.com
  • redditstatic.com
  • tumblr.com
  • wolfram.com
  • wolframalpha.com
  • wolframcdn.com
  • yelp.com
  • yelpcdn.com
  • News
  • theatlantic.com
  • theguardian.com
  • theintercept.com
  • washingtonpost.com
  • cnn.com
  • latimes.com
  • wired.com
  • reuters.com
  • reutersmedia.net
  • economist.com
  • bloomberg.com
  • nyt.com
  • nytimes.com
  • news.ycombinator.com
  • propublica.org
  • buzzfeednews.com
  • Shopping
  • paypal.com
  • ebay.com
  • ebaycdn.net
  • ebayimg.com
  • ebaystatic.com
  • ebayrtm.com
  • offerup.com
  • craigslist.org
  • stripe.com
  • Google Alternatives
  • duckduckgo.com
  • startpage.com
  • qwant.com
  • searx.me
  • protonmail.com
  • protonmail.ch
  • protonvpn.com
  • protonvpn.ch
  • openstreetmap.org
  • joinpeertube.org
  • Firefox and Mozilla
  • mozilla.com
  • mozilla.net
  • mozilla.org
  • firefox.com
  • firefoxusercontent.com
  • Adguard
  • filters.adtidy.org
  • adguard.com
  • Facebook and Instagram
    • fbcdn.net
    • facebook.com
    • instagram.com
    • cdninstagram.com
    • accountkit.com
    Apple and iCloud
    • api.weather.com
    • me.com
    • akadns.net
    • akamai.net
    • akamaiedge.net
    • apple-dns.net
    • apple.com
    • cdn-apple.com
    • icloud-content.com
    • icloud.com
    • mzstatic.com
    • apple-mapkit.com
    YouTube
    • youtu.be
    • youtube.com
    • googleusercontent.com
    • ytimg.com
    • googlevideo.com
    Miscellaneous
    • digicert.com
    • identrust.com
    • githubusercontent.com