The idea: the same question in three envelopes
Before a browser can open https://shop.example, it asks a DNS resolver for the address. That question has to cross the café Wi-Fi and the ISP. Every router on the way forwards the packets, so every router can read what is not encrypted. The page sends the same lookup three ways: plain DNS on UDP port 53, DNS over TLS (DoT) on port 853, and DNS over HTTPS (DoH) on port 443. The notebook on the canvas shows what the on-path observer writes down each time.
Plain DNS on port 53
The laptop's stub resolver sends a small UDP packet to the resolver the café's DHCP handed out, here the ISP resolver 198.51.100.53. The query for shop.example type A is 30 bytes: a 12-byte header with a 16-bit ID, the name, the type and the class. The answer is 46 bytes. Nothing is encrypted and nothing is signed, so the observer reads the name, the answer, the resolver and the times (Demo: plain DNS on UDP 53, then open the site).
DNS over TLS on port 853
DoT (RFC 7858) sends the same DNS message over a TLS connection on TCP port 853. Each message gets a 2-byte length in front, as in DNS over TCP. The first lookup costs a TCP handshake and a TLS 1.3 handshake; the laptop checks the resolver's certificate for dns.example. After that the connection stays open, and later lookups take one round trip. The observer sees a TLS connection to 192.0.2.53 port 853. The port alone says "this is DNS", so a network can block DoT easily (Demo: DNS over TLS on port 853).
DNS over HTTPS on port 443
DoH (RFC 8484) puts the DNS message in the body of an HTTPS request: POST /dns-query with content-type: application/dns-message, usually over HTTP/2. The answer comes back as status 200 with the same content type. On the wire it is just HTTPS to port 443, like the web pages next to it. The observer can only tell it is DNS if it knows the resolver's address or reads the SNI dns.example (Demo: DNS over HTTPS on port 443).
| Plain DNS | DoT | DoH | |
|---|---|---|---|
| Port | UDP 53 | TCP 853 | TCP 443 (or QUIC) |
| Name and answer | readable | encrypted | encrypted |
| Looks like | DNS | DNS (by its port) | any HTTPS |
| Answer can be forged on the path | yes | no | no |
| First lookup | 1 round trip | 3 (TCP, TLS, query) | 3 (TCP, TLS, query) |
| Who sees the names | the path and the resolver | the resolver | the resolver |
Sizes, timing and padding
Encryption hides the bytes, not their number or their time. A 30-byte query for shop.example and a 32-byte query for clinic.example would give different record sizes. So DoT and DoH clients add an EDNS(0) padding option (RFC 7830): the recommended policy (RFC 8467) pads queries to a multiple of 128 bytes and answers to a multiple of 468. On the page both names give 152 / 492 bytes over DoT and about 208 / 528 over DoH (Demo: the resolver still sees every name). Timing still leaks: a DNS record followed at once by a connection to 203.0.113.10 tells the observer what was looked up.
Forged answers
Plain DNS trusts the first answer whose ID and port match the open query. An observer that can read the query has both, and it is closer to the laptop than the real resolver. Its forged answer A 203.0.113.66 arrives at 4 ms; the real answer at 24 ms finds no open query and is dropped (Demo: forged answer wins on plain DNS). HTTPS still saves the user here: the fake server cannot show a valid certificate for shop.example. Inside DoT or DoH a forged packet fails the TLS record check, because the router has no session key (Demo: forged answer fails against DoH). DNSSEC solves the same problem differently: it signs the records themselves, so even a lying resolver is caught, but it encrypts nothing.
What encryption does not hide
Two things stay visible. First, the next connection: the browser's TLS ClientHello carries the site name in the SNI field in clear text, and the server's IP address is in every packet. Only Encrypted Client Hello (ECH) hides the SNI, and only when the site supports it. Second, the resolver: it must read the question to answer it. DoT and DoH move your names from everyone on the path to the one resolver you chose. The canvas log shows dns.example getting every name.
Choosing a resolver
So the choice of resolver matters: read its privacy policy (what it logs and for how long), prefer one that validates DNSSEC, and use the strict profile (RFC 8310), where the client refuses to fall back to plain DNS when the certificate check fails. A browser that turns on DoH by itself may skip the resolver your company or school runs, and with it any filtering done there. That is a policy question, not a technical one.
See also How a DNS Name Is Resolved for what the resolver does after it gets the question, the HTTPS connection for the TLS handshake that DoT and DoH reuse, the TLS certificate chain for the certificate check, and VPN for hiding the whole path, SNI included, from the café.
What the page leaves out
The TCP handshakes (only counted in the times), recursion from the resolver to the root, TLD and authoritative servers, NAT details, DoH over HTTP/3 and DNS over QUIC (RFC 9250), GET requests with ?dns=, Oblivious DoH (RFC 9230), which hides the client's address from the resolver, the opportunistic DoT profile, Encrypted Client Hello, and how operating systems and browsers pick and fall back between resolvers. All sizes of HTTP/2 headers are toy values.