Skip to content

Search

Articles, tools, solutions and knowledge base guides

Start typing to search across articles, tools and apps.

preload vs prefetch vs preconnect vs fetchpriority: how to use resource hints correctly

Resource hints can speed up a page, but they can just as easily distort browser priorities and waste bandwidth. The key is understanding that each mechanism solves a different problem: preload accelerates a resource needed in the current navigation, prefetch speculates about a future navigation, preconnect prepares a connection to an origin, and fetchpriority only suggests a relative fetching priority. This guide shows how to combine them with LCP, responsive images, fonts, JavaScript modules, Speculation Rules and 103 Early Hints.

Published Written by Reading time 26 min read
On this page Contents: quick navigation between sections

These mechanisms solve four different problems

MechanismScopeWhat it doesTypical use
preloadCurrent navigationFetches a specific resource earlyFont, CSS background, late-discovered LCP
prefetchFuture navigationFetches at low priority for cacheChunk for the next page
preconnectOriginStarts DNS/TCP/TLS earlyCritical CDN or font provider
fetchprioritySpecific requestAdjusts relative priorityLCP image, less important script

A common mistake is treating preload, prefetch, preconnect and fetchpriority as different ways to do the same thing. The HTML Standard separates them clearly: preload is for a resource likely to be needed by the current navigation, while prefetch may be delayed because current-document resources take precedence. [1][3]

preconnect does not fetch a resource at all. It prepares the connection to an origin. fetchpriority is a hint about the relative priority of a specific fetch. [4][5]

Before adding any hint, ask which problem you are solving: late discovery of a file, connection setup latency, a likely future navigation, or an incorrect relative priority for an already-discovered resource?

preload: needed now, discovered too late

Preloading a stylesheet and font

<link rel="preload" href="/en/css/app.css" as="style">

<link
  rel="preload"
  href="/en/fonts/brand.woff2"
  as="font"
  type="font/woff2"
  crossorigin
>

<link rel="stylesheet" href="/en/css/app.css">

The HTML Standard defines preload for a resource that is highly likely to be needed by the current navigation. The browser fetches it according to the destination in as and prioritization signals including fetchpriority. [1]

The best candidates are critical resources that would otherwise be discovered late: a font found after CSS parsing, a CSS background image or a resource initiated by JavaScript. [2]

Preload does not consume or execute the resource by itself. A preloaded script is still only fetched until the page later uses it through its normal mechanism. [2]

as and crossorigin: details determine request reuse

The as attribute is required for rel="preload" and defines the request destination. It helps the browser apply the correct security policy, Accept header and priority. [10]

Fonts and as="fetch" preloads require matching CORS behavior. Fonts are fetched using CORS even for same-origin URLs, so the preload must use a matching credentials mode. [2][10]

If the preload and the later resource use differ in URL, destination or CORS mode, the browser may be unable to reuse the earlier request and can fetch the file again.

prefetch: future navigation, not the current critical path

Prefetching a resource for a future page

<!-- Resource likely needed on a future same-site navigation -->
<link rel="prefetch" href="/assets/editor-chunk.js">

<!-- For future document navigations, prefer Speculation Rules
     where supported. -->

rel="prefetch" hints that a resource may be needed by a future navigation. MDN describes it mainly for same-site navigation resources or subresources used by same-site pages. [3]

The browser can give such requests very low priority, delay them, or effectively skip them when the current page has more important work. The HTML Standard explicitly allows the user agent to delay prefetch in favor of resources needed by the current document. [1][3]

Do not use prefetch for a resource required for the current page's first render. Use preload or improve normal discovery instead.

For future documents, Speculation Rules are the more modern option

Document prefetch with Speculation Rules

<script type="speculationrules">
{
  "prefetch": [
    {
      "source": "list",
      "urls": ["/pricing", "/docs/getting-started"]
    }
  ]
}
</script>

MDN recommends the Speculation Rules API as the preferred mechanism for future document prefetching where supported. Classic <link rel="prefetch"> remains useful for subresources but has limitations for document navigations. [6][7]

Speculation Rules can describe URL lists or patterns, while the browser may skip speculation due to user settings, Data Saver, Battery Saver or its own heuristics. [7]

Only safe GET navigations should be prefetched. Logout, add-to-cart, payment-start and other side-effect URLs must not be speculatively fetched. [7]

preconnect: optimize connection setup, not the file

Preconnect for a critical origin, dns-prefetch for a less important one

<!-- Critical third-party origin -->
<link rel="preconnect" href="https://cdn.example.com" crossorigin>

<!-- Lighter hint for a less critical origin -->
<link rel="dns-prefetch" href="https://analytics.example.com">

preconnect tells the browser that a connection to a given origin will probably be needed soon. For HTTPS this can include DNS resolution, TCP handshake and TLS handshake. [4]

It is most useful for critical cross-origin resources such as fonts, APIs or CDNs. MDN notes that same-origin requests typically gain nothing because the document's connection is already established. [4]

Do not preconnect to many domains. Every connection consumes sockets and memory and may never be used.

dns-prefetch: a lighter hint for less critical origins

dns-prefetch resolves DNS in advance but does not establish TCP or TLS, so its cost is lower than preconnect. [8]

MDN recommends preconnect for the few most important origins and dns-prefetch for other origins where saving only the DNS lookup may still help. [4][8]

For origins serving anonymous CORS resources such as fonts, crossorigin on preconnect can matter so the prepared connection matches the later request mode. [8]

fetchpriority: a heuristic adjustment, not a guarantee

High priority only for a truly important image

<img
  src="/images/hero.avif"
  width="1600"
  height="900"
  alt="Analytics dashboard"
  loading="eager"
  fetchpriority="high"
>

fetchpriority accepts high, low or auto and can be used on elements including <img>, <link> and <script>. MDN stresses that both the browser's base priority and the effect of the hint are implementation-dependent. [5]

The attribute does not make an undiscovered resource appear earlier. If an LCP image is hidden in CSS or created by JavaScript, fix discovery first or use preload.

Use high priority sparingly. If five images all have fetchpriority="high", the browser still needs to decide which request should actually win bandwidth.

preload plus fetchpriority: when combining them makes sense

Preload plus fetchpriority for a critical image

<link
  rel="preload"
  href="/images/hero.avif"
  as="image"
  fetchpriority="high"
>

<img
  src="/images/hero.avif"
  width="1600"
  height="900"
  alt="Analytics dashboard"
  fetchpriority="high"
>

Preload and fetchpriority address different problems and can complement each other. Preload improves discovery, while fetchpriority helps adjust a request relative to competing resources. [1][5]

A typical example is an important LCP image that would otherwise be discovered late, such as a CSS background. Preload can start the request earlier and fetchpriority="high" can signal higher importance.

If the image already appears as a normal <img> high in initial HTML, preload may add little. In that case fetchpriority="high" alone can be enough if profiling shows a priority problem.

Responsive images: do not preload one file if the browser later chooses another

Responsive image preload with imagesrcset and imagesizes

<link
  rel="preload"
  as="image"
  href="/images/hero-960.avif"
  imagesrcset="
    /images/hero-640.avif 640w,
    /images/hero-960.avif 960w,
    /images/hero-1600.avif 1600w
  "
  imagesizes="(max-width: 900px) 100vw, 60vw"
  fetchpriority="high"
>

<img
  src="/images/hero-960.avif"
  srcset="
    /images/hero-640.avif 640w,
    /images/hero-960.avif 960w,
    /images/hero-1600.avif 1600w
  "
  sizes="(max-width: 900px) 100vw, 60vw"
  width="1600"
  height="900"
  alt="Product dashboard"
>

For srcset images, a preload can use imagesrcset and imagesizes. These attributes reproduce the candidate-selection logic of srcset and sizes on the eventual <img>. [11][12]

If preload hardcodes one image but the later <img> selects another candidate, the user may download both. A responsive preload should therefore reflect the actual layout. [11][13]

web.dev also notes that responsive preload depends on document viewport information, which limits how well it can be expressed in very early 103 Early Hints. [13][14]

Fonts and JavaScript modules need special treatment

modulepreload for a JavaScript module

<link rel="modulepreload" href="/en/js/dashboard.mjs">

<script type="module" src="/js/dashboard.mjs"></script>

Fonts are often discovered only after CSS, which makes them classic preload candidates. Use as="font", the correct type and matching crossorigin so the later request can reuse the resource. [2][10]

For JavaScript modules, rel="modulepreload" is the better mechanism because it can fetch, parse, compile and place the module into the module map. [9]

Do not preload an entire module graph without measurement. Fetching too many chunks early can delay CSS, fonts or an LCP image.

103 Early Hints: start before the final 200 response

Example 103 Early Hints response

HTTP/1.1 103 Early Hints
Link: </css/app.css>; rel=preload; as=style
Link: <https://cdn.example.com>; rel=preconnect

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8

HTTP status 103 allows a server to send Link hints before the final 200 response. The browser may use those hints to begin preload or preconnect earlier. [14]

This is especially useful when server-side HTML generation takes measurable time but the server already knows which stylesheet or origin will be critical.

Not every hint fits Early Hints. Responsive image preload that depends on imagesrcset, imagesizes and viewport context has limitations at this very early stage. [13][14]

The most common mistake: too many hints

Anti-patternConsequenceBetter approach
Preload 15 JS filesCompetes with LCP/CSSOnly truly critical modules
Preconnect every domainUnused sockets and TLS workA few critical origins
fetchpriority=high everywhereSignal loses meaningOnly key requests
Prefetch current LCPWrong priority and semanticsPreload or normal discovery

Resource hints compete for the same network capacity. Preload is not free: fetching a noncritical file early can delay CSS, a font, an LCP image or interaction-critical JavaScript. [2]

The same applies to fetchpriority="high" and preconnect. Too many high priorities destroy the signal, while too many connections create unnecessary setup and resource use. [4][5]

The best configuration often contains very few manual hints because the browser already has a preload scanner and internal prioritization system.

How to verify the effect in DevTools

InspectQuestion
Request startDid the resource actually start earlier?
PriorityDid it change as intended?
InitiatorWas the request started by preload, parser, CSS or JS?
Transferred / cacheWas the preload reused later?
Connection timingDid preconnect reduce DNS/TCP/TLS time?

After adding a hint, inspect the Network waterfall. Check request start time, Initiator, Priority, cache reuse and whether the same URL was fetched again.

A preload that is not later consumed or causes an unused-preload warning should be removed or fixed. A preconnect is useful only if later requests actually benefit from shorter connection setup.

Test with throttling and a cold cache. On a fast local connection the cost of DNS, TCP and TLS may be almost invisible.

Decision matrix and production checklist

A simple rule works well: current page plus late discovery means preload, future navigation means prefetch or Speculation Rules, a new critical origin means preconnect, and a wrong relative priority for an already-discovered resource means fetchpriority.

Measure before adding a hint. Measure again afterward. If there is no improvement or competition gets worse, remove the hint.

  • Use preload only for resources required early by the current navigation.
  • Match as, type and crossorigin so the preload can be reused.
  • Prefetch only resources with a high probability of use in a future navigation.
  • Prefer Speculation Rules for future documents where supported.
  • Limit preconnect to a few critical origins.
  • Consider dns-prefetch for less important origins.
  • Use fetchpriority="high" only on a small number of truly critical requests.
  • After each change, inspect the waterfall, cache reuse and Core Web Vitals.

Resource hints work best when they fix a specific discovery or latency problem rather than being added prophylactically. Use preload only for resources the current page genuinely needs early, treat fetchpriority as a small prioritization correction, reserve preconnect for the most important origins, and optimize future navigations with prefetch or Speculation Rules. Re-measure every change in Network and Performance because the browser still owns the final scheduling decisions.

Tools for this topic

preload prefetch preconnect fetchpriority Resource Hints Speculation Rules dns-prefetch modulepreload 103 Early Hints LCP Web Performance Responsive Images Fonts

Frequently asked questions

What is the difference between preload and prefetch?

preload targets a resource needed by the current navigation. prefetch targets something likely to be needed by a future navigation and normally runs at lower priority. [1][3]

Does preload always make a page faster?

No. Preloading the wrong or noncritical resource can take bandwidth away from more important requests. [2]

Do fetchpriority and preload do the same thing?

No. Preload improves discovery and starts a fetch early, while fetchpriority is only a relative priority hint. [1][5]

When should I use preconnect?

When the page will soon need critical resources from another origin and DNS/TCP/TLS setup latency is meaningful. [4]

Should I preconnect to every third-party domain?

No. MDN recommends limiting preconnect to the most critical origins and using dns-prefetch for less important ones. [4][8]

Does a font preload need crossorigin?

Yes. Fonts are fetched with CORS semantics, so the preload should use matching crossorigin, even for a same-origin font. [2][10]

Should JavaScript modules use preload?

Prefer modulepreload, which is designed for modules and may also parse and compile them ahead of use. [9]

Should future-page prefetch use Speculation Rules?

Where supported, MDN prefers Speculation Rules for document prefetching. [7]

Does fetchpriority="high" guarantee the highest priority?

No. It is only a hint. Final scheduling and the effect of the hint are browser-dependent. [5]

How do I preload a responsive image?

Use as="image" with imagesrcset and imagesizes that match the eventual srcset and sizes. [11][12][13]

Can 103 Early Hints contain preload?

Yes. A server can send Link preload or preconnect hints before the final 200 response. [14]

How can I identify a bad preload?

Look in DevTools for an unused preload, duplicate transfer, failure to reuse cache, or worse ordering of critical requests.

Sources and references

  1. WHATWG HTML Standard, link type preload↩1↩2↩3↩4↩5↩6
  2. MDN, rel=preload↩1↩2↩3↩4↩5↩6↩7
  3. MDN, rel=prefetch↩1↩2↩3↩4
  4. MDN, rel=preconnect↩1↩2↩3↩4↩5↩6↩7
  5. MDN, fetchpriority HTML attribute↩1↩2↩3↩4↩5↩6
  6. MDN, Speculative loading↩
  7. MDN, Speculation Rules API↩1↩2↩3↩4
  8. MDN, Using dns-prefetch↩1↩2↩3↩4
  9. MDN, rel=modulepreload↩1↩2
  10. MDN, <link> element and preload as/crossorigin↩1↩2↩3↩4
  11. MDN, HTMLLinkElement.imageSrcset↩1↩2↩3
  12. MDN, HTMLLinkElement.imageSizes↩1↩2
  13. web.dev, Preload responsive images↩1↩2↩3↩4
  14. MDN, 103 Early Hints↩1↩2↩3↩4

Was this helpful?

Get new articles by email

One short email per new Learning article. No spam, unsubscribe in one click.

We only use your email to send new articles. No third-party sharing.

Back to Learning