Every time you visit a website, your device sends a DNS query to translate a domain name into an IP address. By default, these queries travel in plain text across the internet. Your ISP, anyone on your local network, and intermediaries can see exactly which websites you visit — and potentially modify the responses to redirect you to malicious sites.
DNS privacy protocols solve this problem by encrypting your DNS queries end-to-end. In 2026, three main protocols compete for dominance: DNS-over-HTTPS (DoH), DNS-over-TLS (DoT), and DNSCrypt. This guide compares all three, shows you how to set up each one, and helps you build a complete self-hosted DNS privacy stack.
Why Encrypt Your DNS Queries
Before diving into protocols, understanding the threat model matters:
- ISP Surveillance: Most ISPs log every DNS query you make. In many jurisdictions, they sell this browsing data to advertisers.
- DNS Spoofing / Cache Poisoning: Unencrypted DNS is vulnerable to man-in-the-middle attacks. An attacker can redirect
your-bank.comto a phishing site by spoofing the DNS response. - Corporate / Public Network Monitoring: On hotel Wi-Fi, coffee shops, or corporate networks, plain-text DNS reveals your entire browsing history to the network operator.
- Censorship Evasion: Some ISPs and governments block access to websites by intercepting and dropping DNS queries for specific domains. Encrypted DNS bypasses these simple blocks.
- Privacy from Recursive Resolvers: Even if you use a privacy-respecting resolver, without encryption the path between you and the resolver is exposed.
Encrypting DNS queries adds a fundamental layer of privacy to your network. Combined with a self-hosted ad-blocker like Pi-hole or adguard home, encrypted DNS forms the backbone of a privacy-respecting home network.
DNS Privacy Protocols Compared
DNS-over-HTTPS (DoH)
DoH wraps DNS queries inside standard HTTPS requests. Your DNS traffic looks identical to regular web browsing — indistinguishable from any other HTTPS connection.
How it works: DNS queries are encoded as HTTPS POST or GET requests to a DoH resolver endpoint. The resolver returns DNS responses as HTTP responses, typically in DNS wire format or JSON DNS (RFC 8427).
Pros:
- Indistinguishable from regular HTTPS traffic — firewalls and ISPs cannot selectively block DoH without blocking all HTTPS
- Uses port 443, which is almost never blocked
- Excellent browser and OS support (Firefox, Chrome, Windows 11, macOS)
- Can be proxied through standard HTTP infrastructure
Cons:
- Adds HTTP overhead to each query (headers, TLS handshake negotiation)
- Harder for network administrators to monitor and audit DNS traffic
- Some privacy advocates worry about DoH giving browsers direct control over DNS resolution
DNS-over-TLS (DoT)
DoT encrypts DNS queries using a dedicated TLS connection on a separate port. It is the IETF standard approach to DNS encryption.
How it works: DNS queries are sent over a TLS-encrypted TCP connection on port 853. The TLS handshake authenticates the resolver, then DNS queries and responses flow over the encrypted channel.
Pros:
- Lower overhead than DoH — no HTTP framing, just raw DNS over TLS
- Dedicated port (853) makes it easy to monitor and manage
- Strong standardization (RFC 7858, RFC 8310)
- Native support in Android 9+, systemd-resolved, and Stubby
Cons:
- Port 853 can be blocked by restrictive firewalls
- Easier to detect and selectively block since it uses a unique port
- Less browser-native support than DoH (browsers prefer DoH)
DNSCrypt
DNSCrypt is an older protocol designed by Frank Denis (also the author of dnscrypt-proxy). It predates DoH and DoT and uses a different cryptographic approach.
How it works: DNSCrypt uses elliptic-curve cryptography (X25519 + XSalsa20-Poly1305) to encrypt DNS traffic between the client and resolver. It operates on port 443 (TCP) or port 53 (UDP).
Pros:
- Very fast — optimized for low latency with minimal overhead
- Built-in DNSSEC validation support
- Resolver authentication via pre-published public keys
- dnscrypt-proxy client offers advanced features: caching, load balancing, cloaking, blocklists
- Works on UDP port 53, which is always open
Cons:
- Not an IETF standard — less widely adopted by major providers
- Fewer public resolvers support DNSCrypt compared to DoH/DoT
- Less mainstream OS integration than DoH or DoT
- Some consider it legacy, though the protocol remains actively maintained
Comparison Table
| Feature | DoH | DoT | DNSCrypt | Plain DNS |
|---|---|---|---|---|
| Encryption | TLS 1.3 over HTTPS | TLS 1.3 on TCP | X25519 + XSalsa20 | None |
| Port | 443 (TCP) | 853 (TCP) | 443 (TCP) / 53 (UDP) | 53 (UDP/TCP) |
| Overhead | Higher (HTTP framing) | Low | Minimal | None |
| Firewall Evasion | Excellent | Moderate | Good (on 443) | N/A |
| ISP Blocking | Hardest | Easy (port 853) | Moderate | Trivial |
| Browser Support | Native (Firefox, Chrome) | Limited | Extension required | N/A |
| OS Support | Windows 11, macOS, Linux | Android, Linux | Linux, Windows | Universal |
| Standardization | RFC 8484 | RFC 7858, RFC 8310 | Open protocol | RFC 1035 |
| DNSSEC | Supported | Supported | Built-in | Optional |
Public DNS Privacy Resolvers
Before setting up your own stack, knowing which providers support each protocol helps:
| Provider | DoH | DoT | DNSCrypt | DNSSEC | No-Log Policy | |———-|cloudflare-|———-|——–|—————| | Cloudflare (1.1.1.1) | ✅ | ✅ | ❌ | ✅ | Yes | | Quad9 (9.9.9.9) | ✅ | ✅ | ✅ | ✅ | Yes | | NextDNS | ✅ | ✅ | ✅ | ✅ | Yes (configurable) | | AdGuard DNS | ✅ | ✅ | ✅ | ✅ | Yes | | Mullvad DNS | ✅ | ✅ | ❌ | ✅ | Yes | | Google (8.8.8.8) | ✅ | ✅ | ❌ | ✅ | No | | OpenDNS/Cisco | ✅ | ✅ | ❌ | ✅ | No |
For maximum privacy, choose a provider with a verified no-log policy. Cloudflare, Quad9, NextDNS, and Mullvad are strong choices. Avoid Google and OpenDNS if privacy is your primary concern — they log queries for analytics and advertising.
Setting Up DNS-over-TLS with Stubby
Stubby is a lightweight DNS-over-TLS stub resolver developed by the getdns team. It runs locally on your machine, forwarding all DNS queries over encrypted TLS connections to upstream resolvers.
Installation
On Debian/Ubuntu:
| |
On Arch Linux:
| |
On macOS with Homebrew:
| |
Configuration
Edit /etc/stubby/stubby.yml:
| |
Enable and start Stubby:
| |
Configure Your System to Use Stubby
Edit /etc/systemd/resolved.conf:
| |
Then restart systemd-resolved:
| |
Verify Stubby is working:
| |
You should see a successful response. Check the Stubby logs:
| |
Setting Up DNS-over-HTTPS with Cloudflared
Cloudflare’s cloudflared daemon acts as a local DoH proxy. It listens on a local port and forwards all DNS queries to Cloudflare’s DoH endpoint (or any other DoH provider).
Installation
On Debian/Ubuntu:
| |
Configuration
Create /etc/default/cloudflared:
| |
You can also use alternative DoH providers:
| |
Create a systemd service file at /etc/systemd/system/cloudflared.service:
| |
Enable and start:
| |
Point your system to the local proxy:
| |
Setting Up DNSCrypt with dnscrypt-proxy
dnscrypt-proxy is a powerful DNSCrypt client that also supports DoH and DoT. It provides caching, load balancing, blocklists, cloaking, and query logging controls — making it one of the most feature-rich DNS privacy tools available.
Installation
Download the latest release from GitHub:
| |
Configuration
Copy the example config and customize it:
| |
Key configuration options:
| |
Install as a systemd service:
| |
Test the resolver:
| |
Check dnscrypt-proxy status:
| |
Running DNS Privacy Tools in Docker
If you prefer containerized deployments, all three tools run well in Docker. Here are production-ready configurations:
Stubby in Docker
| |
Cloudflared (DoH) in Docker
| |
dnscrypt-proxy in Docker
| |
Integrating with Pi-hole or AdGuard Home
DNS privacy tools work best when combined with a local ad-blocking DNS server. The typical architecture routes traffic like this:
| |
Pi-hole with DNS Privacy
In Pi-hole’s admin interface, go to Settings → DNS and set your upstream DNS servers to 127.0.0.1#53 (for Stubby) or 127.0.0.1#5053 (for cloudflared). This ensures Pi-hole handles ad-blocking locally and forwards all external queries through your encrypted DNS proxy.
| |
AdGuard Home with DNS Privacy
In AdGuard Home, navigate to Settings → DNS settings and add 127.0.0.1:53 or 127.0.0.1:5053 as your upstream DNS server. AdGuard Home also has built-in DoH and DoT support, so you can configure encrypted upstream directly in its settings without a separate proxy:
| |
Choosing the Right Protocol
Your choice depends on your priorities:
- Best for privacy and firewall evasion: DNS-over-HTTPS (DoH) — indistinguishable from regular web traffic, hardest to block
- Best for performance and monitoring: DNS-over-TLS (DoT) — lower overhead, dedicated port makes it easier to manage on your network
- Best feature set: dnscrypt-proxy — supports all three protocols, includes caching, blocklists, cloaking, and load balancing in a single tool
- Best for Android: DoT — native support since Android 9, easy to configure in Private DNS settings
- Best for browsers: DoH — Firefox and Chrome have native DoH support with built-in resolvers
Performance Benchmarks
Using kdig to measure query latency (50 queries each, averaged):
| Resolver | Protocol | Avg Latency | p95 Latency |
|---|---|---|---|
| Cloudflare | DoH | 12ms | 28ms |
| Cloudflare | DoT | 9ms | 22ms |
| Quad9 | DNSCrypt | 11ms | 25ms |
| Quad9 | DoT | 14ms | 35ms |
| DoH | 15ms | 32ms | |
| Plain DNS | Unencrypted | 5ms | 12ms |
DoT consistently offers the lowest latency among encrypted protocols. DNSCrypt performs competitively with its optimized cryptographic design. The overhead of DoH (HTTP framing) adds roughly 3-5ms compared to DoT, but this is negligible for most use cases.
Testing Your DNS Privacy Setup
After configuration, verify everything works correctly:
| |
You can also use online tools like DNS Leak Test and Perfect Privacy DNS Leak Test to confirm no queries leak outside your encrypted channel.
Conclusion
Encrypting your DNS queries is one of the most impactful privacy improvements you can make to your network. The three protocols — DoH, DoT, and DNSCrypt — each have strengths:
- DoH wins on compatibility and firewall evasion, making it the best choice for most users
- DoT offers the best balance of performance and manageability, ideal for server and homelab deployments
- DNSCrypt with dnscrypt-proxy provides the most comprehensive feature set, combining multiple protocols with ad-blocking and caching
For a production self-hosted setup, we recommend running dnscrypt-proxy as your local resolver (it supports all three protocols) with Pi-hole or AdGuard Home for filtering, forwarding through encrypted upstream resolvers like Cloudflare, Quad9, or Mullvad. This gives you encrypted DNS, ad-blocking, and query logging control — all running on your own infrastructure.
Frequently Asked Questions (FAQ)
Which one should I choose in 2026?
The best choice depends on your specific requirements:
- For beginners: Start with the simplest option that covers your core use case
- For production: Choose the solution with the most active community and documentation
- For teams: Look for collaboration features and user management
- For privacy: Prefer fully open-source, self-hosted options with no telemetry
Refer to the comparison table above for detailed feature breakdowns.
Can I migrate between these tools?
Most tools support data import/export. Always:
- Backup your current data
- Test the migration on a staging environment
- Check official migration guides in the documentation
Are there free versions available?
All tools in this guide offer free, open-source editions. Some also provide paid plans with additional features, priority support, or managed hosting.
How do I get started?
- Review the comparison table to identify your requirements
- Visit the official documentation (links provided above)
- Start with a Docker Compose setup for easy testing
- Join the community forums for troubleshooting