HomeMethod

Knowledge

Web VitalsTechniquesSnippetsAnswersImpactsBottlenecks

DNS Prefetch

Pre-resolve DNS for third-party domains before the browser needs them.

Overview

Every unique hostname a page connects to requires a DNS lookup — typically 20–120 ms of latency. dns-prefetch instructs the browser to resolve hostnames in the background as soon as the HTML is parsed, so when a resource is needed, the DNS step is already complete.

Impact grade, A+ to D: how much of the Lighthouse score this technique can move. Unaffected: TBT, CLS, TTFB.

The Problem

Third-party resources — fonts, analytics, ads, chat widgets — each introduce at least one DNS lookup on first access. These lookups can collectively add 200–500 ms of invisible latency before any byte is received, directly hurting FCP and LCP.

Performance Impact

LCP

20–80ms

if LCP resource is on a third-party domain

FCP

20–120ms

per resolved domain on first load

SI

third-party DNS lookups resolve before they are needed; external resources arrive sooner into the visual loading sequence

Risk: Very Low

hint only — browser may ignore under load

How it works

  1. 01

    Identify third-party hostnames

    Audit the page in Chrome DevTools Network panel and list every unique hostname that is not your own origin.

  2. 02

    Add dns-prefetch hints

    Place <link rel="dns-prefetch" href="//example.com"> in <head> for each third-party hostname. The browser resolves DNS proactively during idle time.

  3. 03

    Upgrade critical domains to preconnect

    For domains serving render-critical resources (fonts, hero images), use rel="preconnect" which also establishes TCP/TLS, not just DNS.

Limitations

  • Browsers limit concurrent DNS prefetch operations. Prefetching too many domains reduces benefit.
  • If a domain is already cached in the OS DNS resolver the hint provides no benefit.
  • dns-prefetch is a hint, not a directive — browsers may deprioritise or ignore it under resource pressure.

Common Mistakes

Adding dns-prefetch for every third-party domain regardless of priority

Focus on domains serving resources needed for initial render. Non-critical domains like analytics do not need prefetch.

Using dns-prefetch when preconnect is warranted

For render-blocking fonts or critical scripts, use preconnect to establish the full TCP+TLS handshake, not just DNS.

Test this techniqueNetwork AuditRun the tool

Need help applying this to your site?

Targeted fixes, not guesswork. We identify which techniques move the needle for your specific WordPress stack.

Start an Engagement
Support our family now