Start with the timing problem

A browser discovers most page resources while parsing HTML and processing CSS or JavaScript. Some important resources are found late. A font may be referenced inside a stylesheet, for example, while an image may not appear in the HTML until a script adds it. Resource hints let a page tell the browser about work it could start earlier. They do not guarantee that work will happen: browsers can weigh the hint against network conditions, priorities and their own scheduling decisions.

The three hints answer different questions. Preload says, “This page needs this resource soon.” Prefetch says, “A future page might need this resource.” Preconnect says, “This page may soon need a connection to this origin.” Choosing between them starts with identifying what is late: discovery of a required file, preparation for a possible next navigation, or setup of a cross-origin connection.

Use preload for a resource this page needs

Preload asks the browser to fetch a specific resource early for the current page. It is most useful when a resource is important to the initial view but would otherwise be discovered late. Possible candidates include a font used in prominent text, a critical image referenced through CSS, or a stylesheet that another part of the page would load later. A resource already discovered promptly by the browser may gain little from being preloaded.

A preload needs the right resource type, expressed with an as value such as font, image or script. That value helps the browser assign a suitable priority and apply the correct request rules. The preload request must also match the resource’s eventual request. For fonts, this commonly means including the appropriate crossorigin setting, even when the font is hosted on the same origin. If request settings or URLs differ, the browser may download the file twice or leave the preload unused.

Preload only a small number of resources with a clear role in the initial page. Starting too many downloads early can compete with the document, styles and other essentials. It is also worth checking which image the browser actually chooses at different viewport sizes before preloading an image: an early request for the wrong variant wastes bandwidth.

Use prefetch for a plausible next step

Prefetch is a speculative request for a resource that may be useful during a later navigation. Imagine a product listing where visitors often open an item detail page. Prefetching a resource for a likely next page may reduce the wait if that navigation occurs and the fetched response remains usable. Unlike preload, prefetch is not a way to accelerate a resource needed to render the current page.

Because the visitor may never take the predicted path, prefetch should be selective. A long menu of possible destinations is not a good reason to fetch assets for every destination. Browser behavior and cache reuse can vary, so a prefetched response is not a promise of a faster next page. Be especially cautious with large files, metered connections and pages containing personalized content. The expected benefit should justify the extra request.

Use preconnect when connection setup is the delay

Before a browser can request a resource from another origin, it may need to resolve a name and establish a secure connection. Preconnect asks it to begin that setup early. This can help when a page will soon request an important asset from a known cross-origin host, but the browser has not yet encountered the resource itself. For example, a page whose key font comes from a separate font-hosting origin might benefit from connecting to that origin before the stylesheet reveals the font request.

Preconnect names an origin, not an individual file, and does not download the eventual resource. It is therefore different from preload even when both target the same host. Connections consume resources, and opening one to an origin that is never used provides no benefit. Limit preconnect to a few likely, important origins rather than every third-party service on the page. If an origin is only a remote possibility, waiting for normal discovery may be preferable.

Choose, test and simplify

A useful decision sequence is: Does the current page definitely need a specific file that is discovered late? Consider preload. Is a resource useful only if the visitor takes a likely next step? Consider prefetch. Will an important cross-origin request happen soon, but its file is not known or ready to request yet? Consider preconnect. These hints can coexist, but each should have a distinct purpose.

Test the page before and after adding a hint using browser network tools. Look for when the request begins, whether a preload is used by the eventual request, whether prefetch adds traffic without being reused, and whether a preconnect reaches an origin the page actually uses. Check both a fresh visit and repeat navigation where relevant. If a hint produces duplicate work, delays something more important, or makes no observable difference, remove it. The best resource-hint strategy is usually a short list tied to real delays, not a collection of guesses.

Back to category ↗