DNS filtering rules syntax

AdGuard for Android and Adguard Home provides DNS ad blocking feature. To learn more about the principle of DNS filtering, read this KB article. Compared to the traditional ad blocking, DNS filtering is more "crude" and allows less customization. It doesn't support the complex syntax we use in our filters, but it does support simplified syntax that allows you to block certain domains.

DNS filtering supports two types of rules:

  • Basic filtering rules, which is the same as AdGuard's basic rules, but with a limited set of modifiers supported:

  • “Hosts” rules, which is basically the same as /etc/hosts


  1. ||example.org^- block access to the example.org domain and all it's subdomains
  2. @@||example.org^ - unblock access to the example.org domain and all it's subdomains
  3. example.org - AdGuard will now return address for the example.org domain (but not it's subdomains)
  4. ! Here goes a comment - just a comment
  5. # Also a comment - just a comment
  6. /REGEX/ - block access to the domains matching the specified regular expression

Use this syntax to create or import rules to DNS filter. If you have any questions, feel free to post them on our forum.