API

DNS leak test API

Shows which resolver actually answers a machine’s DNS queries, by watching which one reaches our authoritative nameserver. Works with or without a VPN. Free, no key, no account.

Why this cannot be answered locally

/etc/resolv.conf and dig show which resolver a machine is *configured* to use, not which one answered. Only the authoritative side sees that, and this service is that side.

You are testing the network this process runs on. On the user’s own machine that is the right answer. From a cloud agent or CI runner, it describes that datacenter, not the user.

Usage

  1. GET /api/new returns a testId and a list of single-use hostnames.
  2. Resolve every hostname with the system resolver. Only the lookup matters; fetching one over HTTPS is expected to fail TLS.
  3. GET /api/result/<testId> returns the resolvers observed, each with location and network operator, plus a verdict. Results are kept for ten minutes.

Send Accept: text/plain for terminal-readable output, or Accept: application/json for JSON. curl and wget get text by default.

Resolve both name families

Half the hostnames end -aNN and answer A records. Half end -qNN and answer AAAA while deliberately withholding A. Resolving only the `-a` half is an incomplete test. Resolve the whole list you were given.

Both halves find more of a resolver pool and exercise your stub resolver’s AAAA path. They do not separate IPv4 from IPv6: the stub resolver picks who answers, not the query type.

Limits

Limits are per calling address. Going over returns 429 with Retry-After: back off and retry. /api/result/<id> returns 503 (nameserver_unavailable, with Retry-After) when it cannot read our nameserver for a moment. Retry it: that is not a result, and your test is not lost.

  • Starting a test (/api/new, /api/session): 60 immediately, then one every 2 seconds.
  • Reading a result (/api/result/<id>): 600 immediately, refilling ten times a second.
  • GET /api/health reports whether geolocation enrichment is healthy.

No bot detection or user-agent filtering. Please do not poll a finished test in a loop: a result only changes while queries are still arriving.

Examples

shell

ID=$(curl -s -H 'Accept: application/json' https://dnsleak.dev/api/new \
  | grep -o '"testId":"[^"]*"' | cut -d'"' -f4)

for n in 01 02 03 04 05 06; do
  dig +short      "$ID-a$n.t.dnsleak.dev" >/dev/null   # A records
  dig +short AAAA "$ID-q$n.t.dnsleak.dev" >/dev/null   # AAAA only
done

sleep 1
curl -s "https://dnsleak.dev/api/result/$ID"

node

import { promises as dns } from 'node:dns';

const base = 'https://dnsleak.dev';
const { testId, hostnames } = await (
  await fetch(`${base}/api/new`, { headers: { accept: 'application/json' } })
).json();

// Both families. A -q name has no A record, so ask it for AAAA.
await Promise.all(
  hostnames.map((h) =>
    dns.resolve(h, h.includes('-q') ? 'AAAA' : 'A').catch(() => {})
  )
);

const report = await (
  await fetch(`${base}/api/result/${testId}`, { headers: { accept: 'application/json' } })
).json();

console.log(report.verdict.status, report.verdict.detail);

python

import socket, time, urllib.request, json

base = "https://dnsleak.dev"

def get(path):
    req = urllib.request.Request(base + path, headers={"Accept": "application/json"})
    return json.load(urllib.request.urlopen(req))

new = get("/api/new")

for host in new["hostnames"]:
    family = socket.AF_INET6 if "-q" in host else socket.AF_INET
    try:
        socket.getaddrinfo(host, None, family)
    except socket.gaierror:
        pass  # the lookup is the payload; the answer is not

time.sleep(1)
report = get("/api/result/" + new["testId"])
print(report["verdict"]["status"], report["verdict"]["detail"])

There is no curl … | sh one-liner, on purpose.

Interpreting the result

verdict.status
no_leak, split or inconclusive. Read this, not `leaking`, and handle an unrecognized value rather than assuming the set is closed. leak is in the type but nothing returns it. split: most lookups went to one resolver and a minority went elsewhere, which is what an intermittent leak looks like. inconclusive: no determination was made, either because nothing reached our nameserver or because a resolver answered from another country with nothing to corroborate a leak. We cannot see what you configured, so we name who answered and do not grade it. Never treat inconclusive as a pass.
verdict.leaking
Kept for compatibility. true only for split; false for inconclusive, which is not a pass. headline and detail say the same in prose.
client
The caller as we see them: ip, city, country, countryCode, lat, lon, asn, org, hostname. Everything else is judged against this.
lookups
How many of the test hostnames reached our nameserver. Each hostname counts once, however many addresses asked for it. If it is lower than the number you resolved, some lookups have not arrived yet or were stopped on the way, so read the result again before trusting the verdict.
groups[]
Resolvers collapsed by operator. One resolver commonly answers from many egress addresses, and Cloudflare routinely uses a dozen or more in a single test, so groups.length is what "how many resolvers" means. label is what to call it, members are its addresses, status is its worst member. Observers are not in here. See observerGroups.
observerGroups[]
Addresses that only repeated names another address had already asked for. Every name is single-use, so your resolver is always the first to ask; a repeat learned it second-hand. Same shape as groups[]. Not your DNS, never part of the verdict, and not shown in the web UI. Kept here for debugging.
resolvers[].role
resolver if it answered for you, observer if it only ever repeated lookups. Decided per operator, not per address: pool members retry each other, so a group counts as answering if any of its addresses introduced a name.
resolvers[].original / .echoed
Names this address was first to ask for, and names it asked for only after another address had. echoLagMs is how far behind the first ask its earliest repeat came. These three are the evidence behind role.
resolvers[].status
matched (same country and network, which is also what an ISP hijacking port 53 looks like, so it states who answered and grades nothing), same-country (same country, different network), operator (a known public provider), foreign (a different country from yours, reported and not graded), minority (handled a small share of your lookups alongside a dominant resolver; this is what drives a split verdict), observer (not your resolver; see role), or unknown when we could not place the caller. minority wins over foreign when both apply, so a missing foreign does not mean nothing answered from abroad. Check country on the group.
resolvers[].operator
The named provider, identified from reverse DNS, then known address ranges, then ASN. Not a leak if the user chose it.
resolvers[].anycast
True for named operators. Their addresses are anycast, so city and country are a database guess, not where the query went. Do not build a verdict on them.
resolvers[].sawA / .sawQ
Which name family this resolver was asked about. Do not read an IPv6 leak into a one-sided split. A rotating pool produces them by chance, and sawQ is set by any query for a -q name including an A query, so the split does not track the transport the caller used.
resolvers[].hostname
Reverse DNS, when it exists. Often the best evidence of who a resolver is: a NextDNS node on leased space shows its host’s ASN but the PTR dns.nextdns.io.
resolvers[].ecs
A network prefix the resolver volunteered via EDNS Client Subnet. A privacy finding in its own right, not a leak. ecsIsClient says whether that prefix actually contains the caller. False means the resolver sent a coarser nearby block.
resolvers[].dnssecOk
The resolver set the DNSSEC OK bit, so it is DNSSEC-aware. This does not prove it validates signatures.
resolvers[].transport
udp or tcp. count is how many queries that address answered, firstSeen when it first reached us.
truncated
The nameserver stopped recording new addresses at its per-test cap. The operators are complete; the address lists may not be.

Notes

Changing DNS provider does not fix a leak. Fix whatever diverts the query: the VPN, the OS, the router, or a device that ignores both.

The page itself loads nothing from anyone else: no trackers, no analytics, no third-party scripts, fonts or STUN servers. Server-side, addresses are resolved against local offline IP databases and enriched with reverse DNS. A hosted geolocation lookup is spent only where the local answer is unusable, such as an anycast resolver or an unplaced datacenter range. Ordinary visitor addresses never leave the machine. Database credits are listed on /privacy.

Test results are held in memory for ten minutes and then discarded. What is written to disk is a daily tally of how many tests ran, how many completed and how many found a leak, with no addresses, user agents or paths. Requests refused for going over a rate limit also get one line each, with the time and which part of the site but no address, kept 14 days.

Pages