Resource Hints, Preload, Prefetch and Preconnect

Intermediate · 7 min

How preload, prefetch, preconnect and fetchpriority tell the browser what to load early, what each one costs when misused, and what a test showed they do.

Before thisScript Loading, Async, Defer and Modules

Elementive · 7 min

Resource Hints, Preload, Prefetch and Preconnect

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by ElementiveReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • A browser only discovers a resource when it reads the markup or CSS that mentions it. A hint lets you announce it earlier: `preload` for this page's critical resource, `prefetch` for a likely next page, `preconnect` to open a connection to another origin.
  • `preload` needs an `as` value and, for fonts, `crossorigin`. A preloaded image later used by an `<img>` was fetched once in a test, and a preload that nothing used produced a console warning in Chromium.
  • `prefetch` is low priority and for the next navigation. In a test, the request carried `Sec-Purpose: prefetch`, and the later page used the cached copy with no second request.
  • `fetchpriority="high"` or `"low"` on `<img>`, `<link>` and `<script>` nudges the browser's ordering. In Chromium, an image got High, Low or Medium depending on the attribute.
  • Every hint spends bandwidth or connections. Use `preload` for one or two things you know are needed early, such as the LCP image, not for everything.

The discovery problem

A browser loads a page by reading it. It finds the stylesheet link, fetches the CSS, parses it and only then learns about the font and the background image the CSS names. Each of those discoveries starts a new network request, and each request waits behind the one that revealed it. The page is slow not because the files are big, but because they are found late.

Resource hints fix that by telling the browser what is coming before it would find out for itself. Think of a restaurant where the kitchen reads the orders one at a time: a hint is a note to start the slow dish early. Used well, it saves a round trip. Used for everything, the kitchen does too much at once and the dish you wanted is not any faster.

preload

preload says: this page needs this resource soon, fetch it now.

<link rel="preload" href="/hero.jpg" as="image">
<link rel="preload" href="/inter.woff2" as="font" type="font/woff2" crossorigin>

as tells the browser the type, which sets the right priority and request headers. Fonts need crossorigin even from the same origin, because font fetches use CORS. I did not reproduce the failure that guidance warns about. In a test with a preloaded font and an @font-face pointing at it from another origin, the server saw one request in Chromium, and one in Firefox, so I cannot confirm a double download from my own run; follow the guidance anyway.

What I did observe: a preloaded image later added as an <img> was requested once, in Chromium and Firefox. A preloaded image that nothing used was still downloaded, and Chromium logged “was preloaded using link preload but not used within a few seconds from the window’s load event”. Firefox logged no such warning that my test could see. Preload is a promise that the resource is needed. Break it and you spend bandwidth, so reserve it for a couple of critical resources, usually the LCP image and a font.

prefetch

prefetch is for the future: the next page the user will probably visit. The browser fetches it at low priority when idle and keeps it in the cache.

<link rel="prefetch" href="/next-page.html">

In a test, a prefetched image arrived with the header Sec-Purpose: prefetch in Chromium and Firefox, and when the next page used the same image, the server saw no second request. Prefetch is the least certain hint: browsers may skip it on slow connections or when data saving is on. According to web-features 3.47.0 it is not Baseline: Safari supports it only behind a flag.

preconnect and dns-prefetch

Contacting another origin costs a DNS lookup, a TCP connection and a TLS handshake, before a single byte moves. preconnect does that work early.

<link rel="preconnect" href="https://fonts.example" crossorigin>

Use it for the one or two third-party origins you will certainly hit. dns-prefetch does only the DNS step, a cheaper fallback; web-features marks it newly available since September 2025. preconnect is Baseline widely available. I could not observe preconnect in my test: a local server saw no connection opened in headless Chromium or Firefox, so treat that as unverified here, and check it in DevTools’ network panel on a real page, where the connection shows with its timings.

fetchpriority

Not a hint to fetch, but to order. fetchpriority="high" raises, and "low" lowers, a resource’s priority relative to its default. It works on <img>, <link> and <script>. In a test via the Chrome DevTools Protocol, three images got initial priorities of High (fetchpriority="high"), Low (low) and Medium (no attribute) in Chromium. Per web-features it is newly available in Chrome 103, Firefox 132 and Safari 17.2, so it is a safe enhancement and ignored elsewhere. Its best use is fetchpriority="high" on the hero <img>, which is often enough without a preload. Pair it with loading="lazy" on images below the fold, covered in lazy loading and image decoding.

Measuring

Every one of these should be judged in the network panel. Look at whether the resource now starts earlier and whether LCP improves, as in web performance and Core Web Vitals. A hint that does not move a metric should go. The HTML performance lesson puts hints beside other costs. modulepreload, a preload that also parses and compiles an ES module, is Baseline widely available per web-features.

What the video covers

The embed is the whole of Elementive’s “Speed Up Your Website: Preload, Prefetch, Preconnect and More!” (March 2025). Its description says it explains preload, prefetch, preconnect, dns-prefetch and fetchpriority, how they work, and when to use them. It is from a marketing-solutions company’s channel, so expect a site-owner framing rather than a developer’s, and there are no chapters. I could not read a transcript. The runner-ups are a vendor demo with timings and a three-minute fetchpriority clip. The preload, prefetch and priority results above came from my own tests, in headless Chromium and Firefox (priority in Chromium only); the preconnect and font double-fetch claims are explicitly not verified.

Where this fits

This follows script loading. The final lesson in this group is social metadata and structured data.

Check yourself

  1. 01The hero image is set in CSS as a background, so the browser finds it late. How can you get it requested sooner?

    Add `<link rel="preload" as="image" href="hero.jpg">` in the `<head>`. The browser then fetches it straight away instead of waiting for the CSS to be parsed and the element to be laid out. If it is an `<img>`, `fetchpriority="high"` is the lighter fix.

  2. 02What is the difference between `preload` and `prefetch`?

    `preload` is for something the current page needs soon, and is fetched at high priority. `prefetch` is for something a later page may need, and is fetched at low priority when the browser is idle. In a test, a prefetched resource carried `Sec-Purpose: prefetch` and was reused from cache on the next page.

  3. 03You preload an image but never use it. What does Chromium tell you?

    A console warning that the resource was preloaded but not used within a few seconds of the load event. In a test the preloaded image was still downloaded once, which is the cost: bandwidth spent for nothing.

  4. 04When does `preconnect` help, and when does it not?

    It helps when you will soon request something from another origin, such as a font host or API, because the DNS lookup, TCP connection and TLS setup happen early. It does not help for your own origin, which is already connected, and too many preconnects waste sockets.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark