Insights

How to Fix Slow DNS Lookup

Measure DNS lookup delays on Windows, macOS and Linux, identify the slow layer, apply a targeted fix, and retest without breaking private access.

How to Fix Slow DNS Lookup: Open tabbed address book, with the doxxnet wordmark.
On this page

Before you change anything, confirm that DNS is actually the source of the delay. Run the same hostname query through your current resolver and through an approved alternative. The comparison will point to the layer that needs fixing: stale local answers, a browser DNS override, an unreachable DNS server, router forwarding, or the domain's own authoritative DNS.

Change one setting at a time and rerun the original tests. If a change doesn't help, or it breaks internal names, restore your previous configuration.

In short:

  • Measure first: separate DNS time from connection and server time.
  • Compare: same hostname, same record type, different resolver.
  • Fix one thing, retest, and keep a way back.

Start with a measured, reversible fix

DNS translates a hostname into the address an application needs to connect. A pause before a page loads can come from that lookup, but it can also come from setting up the connection or waiting on the server.

So rather than jumping to a cache flush or a provider switch, work through this sequence:

  1. Confirm DNS timing. Inspect the affected request, then run a separate hostname lookup.
  2. Compare repeated queries. Keep the hostname, record type and connection the same while you test your current resolver and an approved alternative.
  3. Locate the affected layer. Compare browsers, devices and, where you're authorized to, another network.
  4. Make one matching change. Fix the browser setting, stale answer, resolver configuration or router issue the comparison points to.
  5. Retest and recover. Check public websites and legitimate private services. Restore the previous configuration if performance gets worse or internal names stop resolving.

Save your original settings before changing them. If several devices are affected, focus on their shared router or resolver instead of clearing every device's cache.

Separate DNS delay from connection and server delay

Your browser's request timing shows which phase is slow. A long DNS lookup phase alongside normal connection and response phases means DNS is part of the delay.

  1. Inspect the affected request. Open your browser's developer tools and go to the Network tab. Reload the page and select the first document request. Look at the DNS lookup, initial connection, TLS negotiation and server response times separately. If DNS timing looks normal, investigate whichever of the other phases is slow.
  2. Run a DNS-only comparison. Use the commands below for your operating system. These are read-only tests that normally need no administrator rights and leave nothing to undo. Query only destinations and resolvers you're permitted to use.
  3. Keep the answers and errors. Record the hostname, resolver, returned addresses, elapsed time and any timeout. Repeat the test during a slowdown instead of treating one result as a diagnosis.

Windows PowerShell

This measures a DNS-only query through your configured resolver, then through an approved alternative. Use the same hostname for both.

$hostname = Read-Host "Permitted public hostname"
$baseline = Measure-Command {
    Resolve-DnsName -Name $hostname -Type A -DnsOnly | Out-Host
}
$baseline.TotalMilliseconds

$resolver = Read-Host "Approved resolver address"
$comparison = Measure-Command {
    Resolve-DnsName -Name $hostname -Type A -DnsOnly -Server $resolver | Out-Host
}
$comparison.TotalMilliseconds

The elapsed time includes some command overhead, so use it to compare runs against each other, not as a packet-level measurement. Keep the displayed answers or errors along with the time.

macOS and Linux

Use dig if it's installed. Replace HOSTNAME and RESOLVER_ADDRESS with the hostname and approved resolver you're testing:

dig HOSTNAME A
dig @RESOLVER_ADDRESS HOSTNAME A

Compare the answer, status and query time. Keep in mind that dig doesn't necessarily follow your browser's Secure DNS settings or the operating system's full name-service path. A fast dig result doesn't rule out an application-specific problem.

Keep IPv4 queries (A) separate from IPv6 queries (AAAA). Also, the first query isn't necessarily uncached, especially at a public resolver, and clearing your device's cache doesn't clear upstream caches. Finally, ping time isn't DNS time, and loading an HTTPS site by IP address isn't a substitute for this comparison.

Use the pattern of failures to choose your next step

The scope of the slowdown narrows down the likely cause. Before changing settings, try another browser, another device and another authorized connection. Each comparison narrows the search, though none proves the cause on its own.

SymptomComparison testNext step
Only one browser stallsOpen the same site in another browser on the same deviceCheck Secure DNS, extensions and proxy settings
Only one device strugglesTest another device on the same networkCheck device DNS settings, tunnels and active interfaces
Every device on the network strugglesCompare wired and wireless, then another authorized networkInvestigate the router, upstream resolver and shared path
One domain stays slow on every networkQuery the same record through several permitted resolversInvestigate the domain's authoritative nameservers and alias chains
A pause ends in eventual successTest each configured DNS serverLook for unreachable resolvers, timeouts or packet loss
Repeat queries get fasterRepeat the same hostname and record typeAccount for caching before crediting a setting

The browser, device and network comparison tells you where to look. If another browser on the same device works fine, look at browser-specific settings. If several devices are affected, look at something they share.

A faster repeat query usually means a cache hit somewhere along the resolution path, not necessarily on your device. If several resolvers slow down together, investigate the shared network path. If an alternative consistently performs better under comparable conditions, look at your configured resolver or its forwarding path.

Correct stale local answers and browser-only problems

If only the browser stalls, check the browser before making system-wide changes. Clearing a local cache is useful after a stale answer or a corrected configuration, but it should be a targeted, one-time action, not routine tuning.

  1. Compare browser settings. Check Secure DNS, extensions and proxy settings against a browser that works. A browser DNS override can use a different resolver than your operating system. Note each original setting before you change it, and restore it if the change doesn't help.
  2. Clear a justified local cache. Use the command below only on a device you administer, and only with authorization for administrator or sudo access.
  3. Restart the browser and retest. Query the original hostname and retry the affected page. If only the browser still stalls, go back to its configuration instead of flushing the system cache over and over.

Windows

Run Command Prompt or PowerShell as administrator:

ipconfig /flushdns

macOS

Run these in Terminal with authorized sudo access:

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

macOS may not print a success message. Retest the lookup instead of assuming silence means failure.

Linux using systemd-resolved

sudo resolvectl flush-caches

These commands remove cached answers. They don't fix a slow upstream resolver. Caches refill on their own and there's no undo, and flushing repeatedly just throws away the speed benefit of caching.

For advanced Linux troubleshooting, fast direct DNS replies combined with slow application lookups are a reason to inspect the Name Service Switch (NSS) and multicast DNS configuration. Check your distribution's intended name-service path before applying an old configuration tweak you found online.

Repair unreachable resolvers and router forwarding

An unexpected or unreachable DNS server can cause a pause before another one answers. Inspect every configured server on every active interface, including virtual ones, instead of assuming the visible primary setting tells the whole story.

  1. Inspect the current configuration. These read-only commands normally need no administrator rights. On Windows PowerShell, use Get-DnsClientServerAddress (or ipconfig /all). On macOS, use scutil --dns. On Linux with systemd-resolved, use resolvectl status. A local stub address points to a resolver service on your device, not necessarily the upstream server. DNS settings can come from DHCP, a network manager or a tunnel, so fix them in whichever system manages them.
  2. Test permitted servers one by one. Use the same hostname and record type as before. Don't assume every listed server is reachable, or that applications use them strictly in the order shown.
  3. Trial an approved alternative on one device. Save the original addresses, or note that they're assigned automatically, before changing anything. Keep a provider's primary and secondary addresses together so its filtering policies stay consistent. If the trial fails, restore the recorded values or automatic assignment.
  4. Check router forwarding when the problem is shared. Where policy allows, compare queries through the router with direct queries to the same upstream resolver. A difference points to the forwarding path instead of comparing unrelated providers.

Only restart a router you administer, and warn other users that connections will drop. If the problem comes back, review firmware and DHCP DNS settings before reaching for a factory reset or blanket network reset. After changing DHCP DNS, renew leases or reconnect clients so they pick up the new settings.

Keep private names and DNS protections working

Comparing public resolvers works for public names. Private names need their intended DNS route. A public resolver may know nothing about an internal zone, so replacing DNS globally can make a private service unreachable even if public sites get faster.

  1. Choose a non-sensitive public hostname. Don't send internal service names to an outside resolver just to measure speed. Test private-service access separately through its intended route.
  2. Look for overlapping DNS controls. Check browser encrypted-DNS overrides, tunnel-supplied DNS, split DNS, filtering and leftover virtual-interface settings. Split DNS sends different names to different resolvers, so a global replacement can break routing that private access needs.
  3. Separate tunnel effects only when authorized. For a public site that doesn't need the tunnel, try disconnecting it where policy allows. Do this only if it won't expose sensitive activity, and never disable interfaces needed for managed access.
  4. Keep protections on. Leave firewall and DNS-rebinding protections enabled. If a legitimate internal domain needs an exception, use logs or a narrowly scoped, administrator-approved change.

Encrypted DNS describes how DNS traffic travels. It says nothing about whether a resolver is faster, so judge latency from comparable measurements. When testing is done, restore your intended browser, tunnel and DNS routing. A faster public lookup isn't a fix if it breaks private access or bypasses required filtering.

Investigate authoritative DNS when one domain stays slow

If a domain stays slow across several resolvers and networks, the problem is likely in its own DNS setup. Recursive resolvers fetch and cache answers for clients. Authoritative nameservers publish a domain's records. They're different parts of the lookup path.

  1. Confirm the domain-specific pattern. Compare the same record type through several permitted recursive resolvers. If other domains resolve normally, check the affected domain's authoritative nameservers.
  2. Inspect delegation and authoritative replies. On macOS or Linux with dig, the read-only commands below normally need no administrator rights. Replace the placeholders, and use them only where direct DNS traffic is allowed.
  3. Act according to ownership. If you administer the domain, check nameserver availability, delegation and unnecessary alias chains. If you don't, send reproducible results to the domain operator.
dig ZONE NS
dig @AUTHORITATIVE_SERVER HOSTNAME A +norecurse
dig HOSTNAME A +trace

ZONE is the relevant DNS zone, and AUTHORITATIVE_SERVER is one of its nameservers. The direct query asks that server for an answer without requesting recursion, because an authoritative server doesn't provide the general recursive service your usual resolver does. A delegation trace follows the lookup path, but restricted direct DNS traffic can stop it from completing.

For a slow domain, a delegation trace can help you investigate authoritative servers or a CNAME alias chain. Review TTL settings against how often your records change. TTL controls how long DNS records are cached, not how fresh page content is, and it isn't a universal speed setting.

If DNS replies are quick but the browser shows slow TLS or initial connection timing, move your investigation to that phase. Changing DNS records won't fix a delay somewhere else.

Verify the improvement and keep a recovery path

A real fix improves the original symptom while keeping answers correct and required access working. Faster timing alone isn't enough if lookups fail, return unsuitable answers or stop resolving private services.

  1. Repeat the original comparison. Use the same domains, record types, connection and timing method after your single change. Keep several timings and failures, not just the fastest result.
  2. Check real behavior. Retry the affected browser or application and your legitimate private services. Confirm the answers are expected, errors haven't increased and the original pause has improved.
  3. Keep a compact before-and-after record.
ItemBeforeAfter
Resolver and connectionOriginal addresses (or automatic assignment) and active connectionThe single setting you changed
Same hostnames and record typesTypical timings, answers and failuresRepeated timings, answers and failures
Original symptomWhere the application pausesWhether that pause improved
Private accessRequired services resolve and connectAccess still works as intended
  1. Restore or escalate. If results get worse, restore your recorded DNS settings and any browser or tunnel changes. Then send the problem to whoever owns the layer you isolated: the device administrator, router administrator, internet provider, resolver operator or domain operator.

When you escalate, include timestamps, the resolver in use, the relevant public hostname, returned results or errors, and which devices are affected. Say whether the slowdown is in DNS timing or a later connection phase, and which comparisons reproduce it. Redact private names and sensitive logs before sharing.

Ask an AI assistant

Share this article

Private Everywhere

Stop giving the internet everything

Keep your browsing, messages, files, and agents private.