Browsers discover resources as they parse HTML and CSS. Resource hints let you tell the browser earlier about what it will need, so it can start connecting or downloading sooner. They are powerful and easy to overuse.

The hints

HintWhat it doesUse for
preconnectOpens DNS, TCP and TLS to an origin earlyCritical third-party or CDN origins used in the first seconds
dns-prefetchOnly resolves DNSOrigins used a bit later; cheap fallback
preloadDownloads a specific resource now, high priorityCritical resources discovered late (fonts, hero image in CSS)
prefetchDownloads a resource at low priority for future navigationThe next page's bundle
fetchpriorityRaises or lowers priority of an element’s fetchThe LCP image (high), below-the-fold images (low)

Preconnect to critical origins

<link rel="preconnect" href="https://cdn.example.com" crossorigin>
<link rel="dns-prefetch" href="https://analytics.example.com">

Limit preconnect to two or three origins actually used early; each one opens a connection whether you use it or not.

Preload what is discovered late

The hero image in a CSS background, or a web font referenced from CSS, is discovered only after the CSS loads. Preload brings it forward:

<link rel="preload" as="image" href="/hero-1200.avif" fetchpriority="high">
<link rel="preload" as="font" href="/fonts/brand.woff2" type="font/woff2" crossorigin>

Fonts must be preloaded with crossorigin, even from your own origin, or they are fetched twice.

fetchpriority for the LCP image

If the LCP image is a normal <img> in the HTML, you usually do not need preload; mark it high priority and make sure it is not lazy-loaded:

<img src="/hero-1200.avif" width="1200" height="630" alt="Product dashboard" fetchpriority="high">

See how to improve LCP.

Prefetch for the next page

If most visitors to a listing page click through to a product page, prefetching the product page's JavaScript chunk makes the next navigation feel instant. Frameworks often prefetch linked routes automatically when links enter the viewport.

Worked example

A marketing site's LCP element was a hero image set as a CSS background, and its brand font was referenced from CSS. LCP was 3.4 s on mobile. Moving the hero to an <img> with fetchpriority="high", preloading the one font weight used above the fold, and preconnecting to the image CDN brought LCP to 2.1 s. An earlier attempt that preloaded six fonts and four images had made LCP worse, because the important image competed with everything else.

Measuring the effect

Compare the LCP sub-parts (resource load delay especially) in a lab test before and after, then confirm with real-user LCP at p75. VitalRix real user monitoring shows LCP per page from real visitors, and the free LCP check highlights the LCP element and its timing.

Common mistakes

  • Preloading too much: every preload competes for bandwidth with what really matters.
  • Preloading resources that are not used, which browsers warn about in the console.
  • Missing crossorigin on font preloads.
  • Preconnecting to many origins, each costing a connection.
  • Lazy-loading the LCP image, then trying to fix it with preload.

Checking what the browser did

In Chrome devtools, the Network panel's Priority column shows each request's priority, and the Initiator column shows whether a preload triggered it. The Performance panel's LCP marker shows when the LCP resource started loading; if it starts after CSS and JavaScript, discovery is late and a hint (or moving the image into HTML) helps. Unused preloads produce a console warning a few seconds after load; treat those warnings as bugs.

When not to use hints

If the page is already fast, hints add complexity for little gain. If TTFB is slow, hints cannot help until the HTML arrives; fix the server first with how to reduce TTFB. And if the LCP element is text, preload the font it uses rather than images. For the full picture of LCP's sub-parts, see what is LCP.

What is the difference between preload and prefetch?

Preload fetches something the current page needs, at high priority. Prefetch fetches something a future page may need, at low priority.

Should I preload my LCP image?

If it is a normal img in the HTML, fetchpriority="high" is usually enough. Preload it if it is discovered late, such as a CSS background.

Does preconnect help for my own domain?

Usually not; the browser is already connected to it for the HTML. It helps for other origins such as a CDN or font host.

Try VitalRix free

Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.