How to Fix Slow DNS Lookup: The Complete Troubleshooting & Fix Guide

How to Fix Slow DNS Lookup: The Complete Troubleshooting & Fix Guide

DNS lookup is the invisible process that happens every time you visit a website. Your browser asks a DNS server for the IP address of a domain and waits for the answer before it can load anything. When that process is slow, every page load suffers even on a perfectly fast internet connection. This guide shows you exactly how to fix slow DNS lookup, step by step.

What actually causes slow DNS lookup?

Before you fix anything, you need to understand what is making your DNS slow. DNS slowness almost always falls into one of four root causes:

Root causeWhat is happeningHow common
ISP DNS server overloadedYour provider assigns a default DNS server shared by thousands of users in your area often poorly maintained and geographically distantExtremely common affects most home users
Corrupted or stale DNS cacheYour OS stores recent DNS responses locally. When that cache gets corrupted or holds outdated records, lookups fail and retry repeatedlyCommon especially after network changes
TTL set too low on your domainA TTL of 300 seconds means every visitor’s browser repeats the DNS lookup every 5 minutes instead of caching it for hoursCommon on shared hosting configurations
Slow hosting nameserversShared hosting providers often run overloaded nameservers that add 200–800ms to every first connection from a new visitorVery common on budget hosting plans

Step 1: Diagnose the problem before changing anything

Never change settings blindly. Run these diagnostic commands first to confirm that DNS is actually the bottleneck and to get a baseline you can compare against after fixing it.

Windows Command Prompt

Open Command Prompt (press Windows + R, type cmd, press Enter) and run:

nslookup yourdomain.com
Expected output: Server name and response timeA response time above 100ms indicates a slow DNS server
ping yourdomain.com
If the first ping takes significantly longer than subsequent ones,DNS resolution is adding latency on your first connection

Mac or Linux Terminal

Open Terminal and run:

dig yourdomain.com
— Look at the “Query time” line at the bottom of the output –Under 20ms  = excellent20 to 80ms  = acceptableAbove 80ms  = worth fixingAbove 200ms = actively hurting your website performance
dig yourdomain.com +stats
— Gives detailed timing data including the responding server —
Online diagnostic tools no installation requiredDNSperf.com compares: Your DNS provider response times against all major alternatives WorldwideDNSchecker.org: Tests DNS propagation and response from multiple global LocationsWebPageTest.org: Shows DNS lookup time in the waterfall chart for any URL you test

Step 2: Switch to a faster public DNS server

This is the single highest-impact fix for most users and takes under five minutes. The default DNS servers from most ISPs respond in 80 to 400 milliseconds. The best public DNS servers respond in 10 to 30 milliseconds, a dramatic improvement that benefits every website you visit.

ProviderPrimary DNSSecondary DNSAvg responseBest for
Cloudflare1.1.1.11.0.0.1~11msSpeed + privacy our top recommendation
Google8.8.8.88.8.4.4~20msReliability and global availability
Quad99.9.9.9149.112.112.112~25msSpeed + automatic malware blocking
OpenDNS208.67.222.222208.67.220.220~30msFamily filtering and content controls

How to change DNS on Windows 11

  1. Open Settings → Network & Internet → click your active connection
  2. Click DNS server assignment → Edit
  3. Switch from Automatic to Manual
  4. Enter 1.1.1.1 as preferred DNS and 1.0.0.1 as alternate DNS
  5. Click Save — the change takes effect immediately, no restart needed

How to change DNS on Mac

  1. Open System Settings → Network → click your active connection
  2. Click Details → navigate to the DNS tab
  3. Remove existing entries using the minus button
  4. Add 1.1.1.1 then add 1.0.0.1 using the plus button
  5. Click OK → Apply

How to change DNS on your router?

This is the most effective approach because it applies faster DNS to every device on your network simultaneously phones, tablets, smart TVs, and computers without configuring each one individually.

  1. Log into your router admin panel typically at 192.168.1.1 or 192.168.0.1 in your browser
  2. Find DNS settings usually under WAN, Internet, or Advanced Network settings
  3. Replace the existing DNS entries with 1.1.1.1 (primary) and 1.0.0.1 (secondary)
  4. Save and restart the router all connected devices now use faster DNS automatically

Step 3: Flush your DNS cache

After switching DNS servers, flush your old cache immediately. Without this step, your system continues using stale stored responses from the old DNS server for hours delaying the benefit of your switch.

Windows

ipconfig /flushdns
You should see: “Successfully flushed the DNS Resolver Cache”

Mac (macOS Ventura and later)

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Enter your admin password when prompted

Linux (Ubuntu / Debian)

sudo systemd-resolve –flush-caches
Verify with: sudo systemd-resolve –statistics

Chrome browser DNS cache (separate from your OS)

Chrome maintains its own independent DNS cache. Flushing the OS cache does not clear Chrome’s cache.

1. Open a new Chrome tab2. Go to: chrome://net-internals/#dns3. Click the “Clear host cache” button4. Also go to chrome://net-internals/#sockets and click “Flush socket pools”

Step 4: Enable DNS over HTTPS (DoH)

Standard DNS queries travel across the network in plain text. This means your ISP, network administrators, and anyone monitoring traffic can see every domain you visit. DNS over HTTPS encrypts those queries which not only improves privacy but prevents DNS hijacking, a common cause of unexpectedly slow or failed lookups.

Enable DoH in Chrome

  1. Open Chrome Settings → Privacy and Security → Security
  2. Scroll to “Use secure DNS”
  3. Switch to “With a specific provider”
  4. Select Cloudflare (1.1.1.1) from the dropdown

Enable DoH in Firefox

  1. Open Firefox Settings → Privacy & Security
  2. Scroll to DNS over HTTPS section at the bottom
  3. Switch to Max Protection
  4. Select Cloudflare as the provider

Enable DoH system-wide on Windows 11

  1. Settings → Network & Internet → your active connection
  2. Click DNS server assignment → Edit → set Manual
  3. Enter 1.1.1.1 as preferred and 1.0.0.1 as alternate
  4. For each entry, open the Encryption dropdown and select “Encrypted only (DNS over HTTPS)”
  5. Save — your entire system now uses encrypted DNS

Step 5: Add DNS prefetching to your website

If you run a website, DNS prefetching tells browsers to resolve DNS for resources they will need before they actually request them. This eliminates lookup delay for third-party resources Google Fonts, analytics scripts, CDN assets, payment processors, and social widgets that most websites load.

Use dns-prefetch for standard third-party resources

Add these tags inside the <head> section of your HTML:

<link rel=”dns-prefetch” href=”//fonts.googleapis.com”><link rel=”dns-prefetch” href=”//cdn.yourservice.com”><link rel=”dns-prefetch” href=”//www.google-analytics.com”><link rel=”dns-prefetch” href=”//www.googletagmanager.com”>

Use preconnect for resources you will definitely load

Preconnect goes further than dns-prefetch: it resolves DNS, establishes the TCP connection, AND completes the TLS handshake in advance. Use it for the most critical third-party resources your page always loads:

<link rel=”preconnect” href=”https://fonts.googleapis.com”><link rel=”preconnect” href=”https://fonts.gstatic.com” crossorigin>
— Only preconnect to 2-3 domains maximum —- Too many preconnects compete for bandwidth and slow each other down —
Performance impactAdding dns-prefetch and preconnect tags regularly removes 200 to 600 milliseconds from perceived page load time particularly for visitors on mobile connections or slower broadband. This is one of the fastest performance wins available for any website.

Step 6: Fix TTL settings on your own domain

TTL (Time to Live) controls how to fix slow DNS lookup long resolvers cache your records before checking again. A TTL of 300 seconds means every visitor repeats the DNS lookup every 5 minutes. A TTL of 86400 seconds means resolvers cache the result for 24 hours dramatically reducing lookup frequency and improving response times for repeat visitors worldwide.

TTL valueDurationWhen to use it
3005 minutesUse temporarily before a planned server migration  allows fast propagation
36001 hourGood default for most active websites that occasionally update DNS records
144004 hoursRecommended for stable websites with infrequent DNS changes
8640024 hoursBest for fully stable, established websites with no planned IP changes

How to update TTL settings?

  1. Log into your DNS provider dashboard Cloudflare, GoDaddy, Namecheap, or your hosting panel
  2. Find your A record and MX record entries
  3. Change the TTL value from the default low value to 3600 or higher
  4. Save the new TTL takes effect after the old TTL period expires
Migration tip the 24-hour ruleIf you are planning a server migration or IP address change, drop your TTL to 300 seconds at least 24 hours before the change. This ensures DNS propagates globally within minutes once you make the switch. Raise it back to 3600 or higher once the migration completes successfully.

Step 7: Move to a premium DNS provider

If you run a business website and DNS speed directly affects revenue or user experience, free DNS from shared hosting is not adequate. Premium DNS providers maintain globally distributed nameserver networks specifically optimised for low latency serving DNS responses from the city closest to each visitor.

ProviderBest forCostGlobal locationsKey advantage
Cloudflare DNSMost websites free tier is excellentFree (paid plans from $20/mo)300+ citiesSub-20ms globally, DDoS protection included
AWS Route 53AWS-hosted infrastructure$0.50/hosted zone/month80+ edge locationsNative AWS integration, latency-based routing
NS1Complex enterprise routingFrom $300/mo30+ PoPsAdvanced traffic management and load balancing
Google Cloud DNSGCP-hosted applications$0.20/zone/monthGlobal anycast100% uptime SLA, tight GCP integration

For most small to medium websites: Moving your domain’s nameservers to Cloudflare is the single most effective DNS performance improvement available delivering enterprise-grade speed, DDoS protection, and a globally distributed network at zero cost. The migration takes about 15 minutes and requires no technical expertise.

How to fix slow DNS lookup verify your worked?

After making changes, always run a second round of diagnostics to confirm the improvement and establish your new baseline.

  • Run dig yourdomain.com again to compare the new Query time to your original measurement. You should see a drop from 150–400ms down to under 20ms
  • Run Google PageSpeed Insights on your website look at the waterfall chart and find the DNS lookup row
  • Use WebPageTest.org with test locations set to multiple cities this shows DNS performance for visitors globally, not just your own location
  • Check the “Time to First Byte” (TTFB) metric a faster DNS directly improves TTFB, which Google uses as a Core Web Vitals signal
DNS lookup timeRatingAction needed
Under 20msExcellent optimal performanceNo action needed
20 to 50msGood acceptable for most use casesMonitor but no urgent fix required
50 to 100msFair noticeable impact on first connectionsApply steps 1–3 from this guide
100 to 300msPoor actively hurting page performanceApply all steps in this guide urgently
Above 300msCritical severe user experience impactSwitch DNS provider immediately and audit nameservers

Priority fix order work through this sequence

Follow this order for maximum impact with minimum time investment:

PriorityFixTime neededImpactCost
Do this firstSwitch to Cloudflare DNS (1.1.1.1)5 minutesVery high biggest single improvementFree
Do this immediately afterFlush your DNS cache1 minuteHigh clears stale records right awayFree
Do this same sessionEnable DNS over HTTPS5 minutesMedium prevents hijacking and improves reliabilityFree
Do this on your websiteAdd dns-prefetch and preconnect tags15 minutesHigh removes 200 600ms from third-party load timesFree
Do this in your DNS dashboardRaise your domain TTL to 3600+5 minutesMedium reduces repeat lookup frequency globallyFree
Do this if you run a business siteMove to Cloudflare nameservers15 minutesVery high enterprise DNS at no costFree

Most people who follow steps one through three see DNS lookup times drop from 150 to 400ms down to under 15ms within minutes of making the changes.

Conclusion

How to fix Slow DNS lookup is almost always caused by a poor default DNS server assigned by your ISP. Switching to Cloudflare’s 1.1.1.1 takes five minutes, costs nothing, and is the fastest single performance improvement most internet users and website owners can make. For website owners, combining that switch with dns-prefetch tags and Cloudflare nameservers typically reduces DNS-related latency by 80 to 95 percent, a meaningful improvement that benefits every visitor, every page load, every day.

Frequently asked questions

Will changing my DNS server affect my internet speed?

Changing your DNS server does not affect your download or upload speeds — your ISP connection bandwidth stays exactly the same. What changes is how quickly your browser resolves domain names before loading pages. On a fast connection where DNS was the bottleneck, you will notice websites feel more responsive and load faster, particularly on first visits to sites you have not recently visited.

Is it safe to use Cloudflare or Google DNS instead of my ISP’s DNS?

Yes, both are safer and more reliable than most ISP DNS servers. Cloudflare has a documented privacy policy committing to never logging or selling DNS query data. Google DNS does retain some query data as described in its privacy policy. Both providers maintain 100% uptime SLAs and protect against DNS-based attacks. Millions of users and major enterprises rely on both services daily.

How do I know if DNS is actually the problem and not something else?

Run “dig yourdomain.com” on Mac/Linux or “nslookup yourdomain.com” on Windows and check the Query time in the output. If it is above 80ms, DNS is a significant contributor to your slowness. Also check your website in WebPageTest.org the waterfall chart shows DNS lookup time as a separate bar for each request, making it easy to identify whether DNS or another factor (server response, large file downloads, render-blocking scripts) is the primary bottleneck.

Does DNS prefetching slow down my page if I add too many prefetch tags?

Yes, adding too many dns-prefetch or preconnect tags causes them to compete for bandwidth and actually slow each other down. Limit dns-prefetch to the domains your page actually loads from. Limit preconnect to a maximum of 2 to 3 of the most critical domains. Every additional preconnect consumes a TCP connection slot. Audit your third-party resources and only prefetch domains you are certain appear on every page load.

My TTL is already high. Why is DNS still slow for first-time visitors?

High TTL helps repeat visitors and cached resolvers, but first-time visitors always perform a fresh DNS lookup regardless of your TTL. For first-time visitors, the speed depends entirely on which DNS server they use and how close your authoritative nameserver is to them geographically. Moving to Cloudflare’s nameservers solves this because their 300+ global locations mean any visitor in the world gets a response from a nameserver within a few milliseconds of their location.

Will these fixes help my website’s Google ranking?

Yes, indirectly. Google uses Core Web Vitals as a ranking signal, and Time to First Byte (TTFB) is directly affected by DNS lookup speed. Faster DNS reduces TTFB, which improves the Largest Contentful Paint (LCP) score, one of the three Core Web Vitals metrics Google measures. Additionally, adding preconnect tags reduces the perceived load time for above-the-fold content, which also positively influences LCP.

About the Author

You may also like these