Skip to main content
miji.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.

Was this article helpful?

Related Terms

DNS Resolution

The process of translating a human-readable domain name into the IP address of the server hosting the website.

Page Speed

A measure of how quickly a web page loads and becomes interactive, affecting both user experience and search rankings.

Cache

A temporary storage mechanism that saves previously fetched data for faster subsequent access. Browser cache and DNS cache are common examples.

CDN

A network of geographically distributed servers that deliver web content from the location nearest to the user. Improves speed and reliability.

TTL

Time to Live - a value that specifies how long data should be cached or considered valid before being refreshed.

Prerendering

An optimization technique that fully renders a page in the background before the user clicks a link, making the subsequent navigation appear instant.

Related Articles

How Redirect Chains Impact Web Performance - Speed Optimization for Short URLs

Quantitative analysis of how short URL redirect chains affect Core Web Vitals and page load speed. Covers redirect hop optimization, edge redirects, and HTTP status code selection for maximum performance.

How URL Shorteners Work - The Technical Side of Redirects

Discover the technical mechanics behind URL shortening: hash generation, database lookups, HTTP redirects, and more. Includes HTTP response examples and base-62 encoding calculations.

What Happens When You Click a Link? A Peek Behind the 0.5-Second Curtain

What happens behind the scenes when you click a link? An adventure-style guide covering DNS, requests, responses, and how URL shortener redirects work.

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