What is a DNS leak, and how do you fix it?

A DNS leak lets a resolver outside your VPN see every site you visit. How to find one, what a country-based leak test misses, and how to fix each cause.

Popo
On this page

Before your browser can open a site, it asks a resolver for the site's address. If you use a VPN or proxy, you expect that question to go through it. When it goes somewhere else, usually to your internet provider, that's a DNS leak. Pages still load through the VPN, so nothing looks wrong.

  1. 1You open a siteThe browser needs its address
  2. 2The lookup goes outIt should go through the tunnel
  3. 3The wrong resolver answersYour provider’s, outside the tunnel
  4. 4The page loads through the tunnelNothing looks wrong

The site sees the VPN. Your provider sees the name of every site.

Whoever runs the resolver sees the name of each site and when you visited. They don't see the pages or what you type.

Check for one

Turn the VPN or proxy on and run the test in the browser you use:

It makes your browser look up names that have never been looked up before, so that no cache can answer, and records which resolvers come to ask for them. Then it compares each resolver's country with the country of your web exit. Standard test is quick. Extended test runs several rounds and finds more resolvers, because large providers use many.

What the result does and doesn't mean

The check compares countries. That makes its answer clear, and it has limits you should know:

Your situationWho answersWhat the check says
VPN exit in Germany, home in JapanThe VPN’s resolver, in GermanyCorrect
VPN exit in Germany, home in JapanYour provider, in JapanLeak
VPN exit in Germany, home in GermanyYour provider, in GermanyCorrect, but it’s a leak
VPN exit in GermanyA public resolver you chose, in FranceLeak, but it may be intended
Four cases. The last two show why the result should be read together with the list of resolvers.
  • A leak inside one country isn't visible. If your VPN exit is in the country you live in, your provider's resolver is in the right country too, and the check says Correct.
  • A different country isn't always a problem. If you chose a public resolver yourself, its servers may be in another country.
  • It covers this browser. Other apps can use a different resolver.

So look at the names in the list, not only the verdict. With a VPN on, you expect to see the VPN provider, or a resolver that you or it chose. If you see the company you pay for internet access, that's a leak, whatever the country.

We asked two home connections which network answers with different settings:

Set toProbe in JapanProbe in Brazil
DefaultAS2516 KDDI, JapanAS13335 Cloudflare, Brazil
8.8.8.8AS15169 Google, JapanAS15169 Google, Brazil
1.1.1.1AS13335 Cloudflare, JapanAS13335 Cloudflare, Brazil
9.9.9.9AS49544 i3D.net, JapanAS7195 EdgeUno, Brazil
Globalping probes on home broadband, 30 November 2026. In every row the resolver was in the same country as the connection, so country alone couldn't tell one provider from another. 9.9.9.9 is Quad9, which appears under the names of the hosting companies it uses.

Look from the command line

Google runs a name whose answer is the address of the resolver that asked:

Terminal
dig +short TXT o-o.myaddr.l.google.com"198.51.100.53"

On Windows:

Command Prompt
nslookup -type=TXT o-o.myaddr.l.google.com

The address is replaced with a documentation one here. Look yours up on the home page to see whose it is. If there's a second line starting with edns0-client-subnet, the resolver is also passing on part of your own address to the site's DNS servers. Both 8.8.8.8 measurements above included it.

The command line uses the system's setting. Browsers can use their own encrypted DNS, so the two can differ, and the browser test is the one that counts for browsing.

Why it happens, and what to do

The VPN doesn't set DNS. Look for "DNS leak protection" or "use the VPN's DNS" in the client and turn it on.

The system asks several resolvers. Windows can send a lookup through more than one network connection and use whichever answers first. Clients with leak protection block this. Check what's configured:

Terminal
scutil --dns | grep nameserver | sort -u  nameserver[0] : 192.0.2.53  nameserver[1] : 198.51.100.53
PowerShell
Get-DnsClientServerAddress | Where-Object ServerAddresses

The first is for macOS and the second for Windows; the output shown is the macOS format with documentation addresses.

A DNS server is set by hand on the network adapter or in the router, and takes priority. Set it back to automatic, or to the VPN's.

The browser has its own. In Chrome's and Firefox's privacy settings, "Use secure DNS" or "DNS over HTTPS" sends lookups to a provider chosen there. The network can't read them, but that provider sees them instead of your VPN's.

The proxy covers only the pages. With an HTTP proxy, or a SOCKS5 proxy set to resolve names locally, lookups go out directly. In a SOCKS client, choose to resolve names at the proxy (in curl, socks5h instead of socks5).

IPv6 isn't covered. A resolver reached over IPv6 bypasses an IPv4-only tunnel. Why proxies can leak IPv6 has the fix.

Split tunneling sends some names outside on purpose. See which exit a site sees.

After a change, clear the cache, close the browser completely and test again:

Terminal
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Command Prompt
ipconfig /flushdns

Is it serious?

It depends on why you use the VPN. If it's only to reach a company system, it matters little. If you don't want your provider to know which sites you visit, a leak defeats the purpose.

Fixing it doesn't hide everything. Networks along the way can still read the site's name from the start of the connection, unless that's inside the tunnel too. And DNS is one of three things to test: how to test a VPN or proxy for leaks covers the rest.

More in Privacy & leaks

DNS and WebRTC leaks, fingerprints and what sites see

All 10 articles