BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

DNS prefetch: What it does and when to use it

DNS prefetch is a resource hint that asks the browser to look up a third-party domain's IP address early, so later requests to that domain start sooner.

Monthly searches · dns prefetch
880
Keyword research data
dns prefetch
DNS prefetch: What it does and when to use it
Click the image to view it full size

Every request to a domain the browser hasn't seen yet starts with a DNS lookup: turning the domain name into an IP address. web.dev puts the usual cost of that lookup at around 20 to 120 milliseconds. A DNS prefetch hint gets it done early, while the page is still loading, so the font, script or image from that domain can start downloading the moment the page asks for it. web.dev

It's one of several resource hints: a suggestion the browser may follow, not a command.

How to add a DNS prefetch hint

Add a link element to the page's <head>, with the origin of the other domain:

<link rel="dns-prefetch" href="https://fonts.googleapis.com/">

If you control the server, you can send the same hint as an HTTP header instead:

Link: <https://fonts.googleapis.com/>; rel=dns-prefetch

Browsers that don't support the hint ignore it, and the page loads as normal. Support is now broad: MDN marks dns-prefetch as Baseline 2025, working in the latest versions of all major browsers since September 2025.

When it helps

DNS prefetch only helps for other domains, the ones your page loads resources from later:

  • web fonts from a font service
  • analytics, chat or consent scripts
  • images or files on a separate content delivery network domain
  • embedded videos, maps or social widgets

Don't add it for your own domain. By the time the browser reads the hint, it has already looked up your domain to load the page.

DNS prefetch vs preconnect

Preconnect goes further. Besides the DNS lookup, it opens the connection and, on HTTPS, completes the TLS handshake. That saves more time, but each open connection costs resources, and the browser closes it again if it isn't used within about 10 seconds.

Hint What it does early Use it for
dns-prefetch Looks up the IP address Third-party domains that are useful but not critical
preconnect Lookup, connection and TLS handshake The few domains the page needs right away, such as your font host

MDN's advice is to preconnect only to the most important domains and use dns-prefetch for the rest. You can also give a critical domain both hints, so a browser without preconnect support still gets the lookup. Put them in two separate link elements:

<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
<link rel="dns-prefetch" href="https://fonts.gstatic.com/">

Fonts load in anonymous mode, so their preconnect needs the crossorigin attribute. Without it, the browser only does the DNS lookup.

Does DNS prefetch help SEO?

Only indirectly. It's a speed tweak for visitors, not a tag search engines look for. Its effect is that third-party resources start a little sooner, which can help your page speed when a page depends on several outside domains. If a page loads little from other domains, it changes almost nothing.

To see whether it works, open your browser's developer tools, reload the page and look at the network waterfall. For a prefetched domain, the DNS part of its first request should shrink or disappear.

DNS prefetch and privacy

Browsers also prefetch DNS on their own, for links and resources they find on a page. Each lookup tells a DNS resolver which domains the page refers to, even if the visitor never clicks. The non-standard X-DNS-Prefetch-Control: off response header asks browsers to stop that automatic prefetching; MDN suggests it when you don't control the links on your pages. Browsers don't prefetch link hostnames on HTTPS pages by default anyway.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.