Skip to main content
短.be

DNS Prefetch

A browser optimization that resolves link destination domain names in advance. Reduces page load time when a user clicks a link.

Aug 23, 2026 · About 1 min read

Redirect

DNS prefetch is a browser optimization technique that proactively resolves the DNS (domain name to IP address conversion) for linked domains before the user clicks. When the link is actually clicked, DNS resolution is already complete, so loading starts sooner by however long that lookup would have taken. How much time this saves depends on the connection and on whether the answer is already cached.

How long DNS resolution takes depends on the connection and on whether the answer is already cached, and it tends to be longer on mobile connections. DNS prefetch gets that wait out of the way before the click. It is enabled simply by adding <link rel="dns-prefetch" href="https://example.com/"> in the HTML head, with the scheme included in the href.

For shortened URLs, DNS prefetch can improve redirect speed. Clicking a shortened URL triggers DNS resolution for the shortener's domain first, then for the destination domain. Prefetching the destination domain eliminates the second DNS lookup, improving perceived speed.

Related technologies include preconnect (DNS resolution + TCP connection + TLS handshake in advance), prefetch (downloading the entire resource ahead of time), and prerender (rendering the full page in advance, now deprecated, with page-level speculative loading handled by the Speculation Rules API). In terms of resource cost versus benefit, dns-prefetch is the lightest with the fewest side effects, making it ideal for pages with many external links.

One caveat: DNS prefetch increases requests to DNS servers. Setting prefetch for every external link on a page adds unnecessary DNS server load, so it is best to limit it to the most important link destinations. Note also that dns-prefetch only helps for cross-origin domains: your own domain has already been resolved by the time the browser reads the hint. When you use preconnect, pairing it with dns-prefetch for the same domain is still worthwhile, because browsers without preconnect support can at least get the DNS lookup done early.

Share on XHatena

Was this article helpful?

Related Terms

Related Articles

FAQ

How do I set up DNS prefetch?
Add <link rel="dns-prefetch" href="https://example.com/"> inside the HTML <head>. Give the href a URL that includes the scheme. The scheme-relative form //example.com was widely recommended in the past, but current documentation examples include the scheme.
What is the difference between DNS prefetch and preconnect?
dns-prefetch only performs DNS resolution in advance. preconnect also establishes the TCP connection and TLS handshake, providing greater speed gains but consuming more resources. Use preconnect for critical external resources and dns-prefetch for the rest.
Are there any downsides to DNS prefetch?
It increases DNS server requests. Setting prefetch for a large number of domains adds unnecessary load to the user's network and DNS servers. Limit it to destinations that are likely to be clicked.

Put the terms to work

Shorten a URL for Free