preload vs prefetch vs preconnect: what is the difference?

IntermediatePerformance interview questionBy , updated 17 November 2026

Short answer

preload downloads a resource the current page will definitely need soon, at a priority that matches its type. prefetch downloads a resource a future navigation will probably need, at the lowest priority, when the browser is idle. preconnect downloads nothing: it opens the DNS, TCP and TLS connection to another origin early, so the first real request from that origin starts faster.

The hints side by side

Hint What it does Use it for Priority When it runs
preload Fetches one file for this page Late-discovered critical files: the LCP image, a font, a CSS background Same as the as type (a font is high, an image is not high by default) Immediately, in parallel with the HTML
modulepreload Fetches, and may parse and compile, an ES module Modules a page imports a few levels deep High, like a module script Immediately
prefetch Fetches a file for a later navigation The next page's JavaScript or data Lowest When the network is idle
preconnect DNS + TCP + TLS to an origin A third-party origin you will request from within seconds n/a (no download) Immediately
dns-prefetch DNS lookup only Origins you may use later, or a fallback for preconnect n/a Immediately, very cheap
<head>
  <!-- Connect early to the font host -->
  <link rel="preconnect" href="https://fonts.example-cdn.com" crossorigin />
  <!-- The hero image is in a CSS background, so the parser would find it late -->
  <link rel="preload" href="/hero.avif" as="image" type="image/avif" fetchpriority="high" />
  <!-- The one font used above the fold -->
  <link rel="preload" href="/fonts/inter-latin.woff2" as="font" type="font/woff2" crossorigin />
  <!-- A module the entry imports two levels down -->
  <link rel="modulepreload" href="/assets/router.js" />
  <!-- The checkout page's code, which most visitors open next -->
  <link rel="prefetch" href="/assets/checkout.js" />
</head>

Why preload exists

The browser's preload scanner already finds <img>, <script> and <link rel="stylesheet"> in the HTML and starts them early. It cannot see files that are only referenced from CSS (background-image, @font-face), from JavaScript, or from a module's imports. Those are found late, often after a chain of two or three requests. preload breaks the chain by naming the file up front. If the file is already a plain <img> in the HTML, preloading it adds little; fetchpriority="high" on the <img> is usually the better fix. The chain itself is explained in the critical rendering path.

The as attribute

as tells the browser what the file is, so it can set the right priority, Accept header and Content Security Policy check, and later match the preloaded response to the real request. Leave it out or get it wrong, and the preload is usually not reused, so the file downloads twice. Adding type (image/avif, font/woff2) lets a browser that does not support the format skip the download.

The crossorigin trap with fonts

Fonts are always fetched in CORS mode, even from your own origin. A font preload without crossorigin is fetched in no-CORS mode, which the browser keeps separate in its cache, so the real font request misses it and downloads the file again. The same applies to preconnect: browsers keep separate connections for anonymous CORS requests and for ordinary requests, so a preconnect to a font host needs crossorigin too. Modules are also fetched in CORS mode, which is why modulepreload defaults to it.

fetchpriority

fetchpriority="high" or "low" adjusts the priority of a single request. It works on <img>, <link>, <script> and fetch(). It is a hint, not an order. Typical uses: high on the LCP image, low on carousel images that are not yet visible, and low on a non-urgent fetch() for analytics. It pairs with preload because a preloaded image is not high priority by default.

How overuse hurts LCP

Every preload competes for the same bandwidth as the HTML, CSS and LCP image. Preload ten fonts and four scripts and the hero image waits behind them, which is the opposite of what you wanted. The browser also warns in the console when a preloaded file is not used within a few seconds of load, because that download was wasted. Each preconnect costs a TLS handshake and CPU, and unused connections are closed after a short time. Keep preloads to the one or two files that are truly critical and late-discovered, and preconnect to two or three origins at most. Check the result in a waterfall rather than assuming; see Core Web Vitals for how LCP is measured.

  • HTTP headers. Link: </hero.avif>; rel=preload; as=image works in a response header, and a server can send it in a 103 Early Hints response before the HTML is ready.
  • React 19. preload, preconnect, prefetchDNS and preloadModule from react-dom let a component declare its hints, and React puts them in the head. In Next.js, next/font preloads fonts and next/link prefetches routes for you.
  • Speculation Rules. For whole pages, Chromium browsers support <script type="speculationrules">, which can prefetch or even prerender the next navigation. That goes further than rel="prefetch", which only fetches single files.

Practise it

Pick the right hint for each resource in Choose resource hints for a landing page, then apply them to a real slow page in Diagnose and fix a poor LCP on a product page. Prefetch route code on intent, Generate speculation rules and Load web fonts with the FontFace API cover the prefetching and font cases.

Common follow-up questions

Is prefetch the same as lazy loading?

No, they are opposites in timing. Lazy loading waits until a resource is needed; prefetching fetches it before it is needed, on a guess. Lazy loading saves bytes on the current page, and prefetching spends spare bandwidth to make the next page faster.

Should I use preconnect or dns-prefetch?

Use preconnect for the few origins you will certainly call in the first seconds, such as your image CDN or font host. Use dns-prefetch for others you might call later, because a DNS lookup is cheap. Some sites list both for the same origin so older browsers still get the DNS step.

Does preload execute a script?

No. preload and prefetch only download. The script runs when a <script> tag or import() asks for it. modulepreload may also parse and compile the module, but it still does not run it.

What happens if the user never visits the prefetched page?

The bytes are wasted. On metered or slow connections that matters, so prefetch on a strong signal (hover, viewport, analytics data) and skip it when navigator.connection.saveData is true where that API exists.

Mistakes to avoid

  • Preloading a font without crossorigin, so it downloads twice

  • Preloading with a missing or wrong as value

  • Preloading an image that is already a plain <img> in the HTML instead of adding fetchpriority="high"

  • Preloading many files until the LCP resource loses the race

  • Using preload for something the next page needs; that is prefetch

  • Preconnecting to origins the page does not use in its first few seconds

Practise it in code

Interviewers rarely stop at the definition. These questions open in an editor with tests.

  1. Choose resource hints for a landing page: preload, preconnect, prefetch, modulepreload and fetchpriorityMedium30 min
  2. Diagnose and fix a poor LCP on a product pageHard45 min
  3. Prefetch route code on intent without wasting bandwidthMedium35 min
  4. Generate Speculation Rules: choose prefetch or prerender and eagerness from navigation dataMedium35 min
  5. Load web fonts with the FontFace API: a timeout, a fallback and a single class swapMedium35 min