Resource hints tell the browser about work it would otherwise discover too late. preconnect opens the connection (DNS, TCP, TLS) to an origin early. dns-prefetch only resolves DNS. preload fetches a resource the current page definitely needs, at high priority. modulepreload does the same for ES modules and also parses them. prefetch fetches something the next navigation probably needs, at idle priority. Each one spends bandwidth, sockets or CPU, so hint only what is critical and late-discovered, and check the result in a waterfall.
| Hint | Scope | Cost if wrong | Typical use |
|---|---|---|---|
dns-prefetch | DNS only | Negligible | Many third-party origins, or as a fallback alongside preconnect |
preconnect | DNS + TCP + TLS | A socket and TLS handshake that may go unused (browsers close idle ones after ~10 s) | 1–3 critical origins: your API, image CDN, font host |
preload | Fetch now, high priority, current page | Steals bandwidth from more important resources; console warning if unused within a few seconds | LCP image referenced only from CSS or JS, critical fonts, critical CSS from @import |
modulepreload | Fetch, parse and compile an ES module | Same as preload | Deep module graphs where the browser would otherwise discover imports one level at a time |
prefetch | Low priority, for future navigations | Wasted data, especially on metered connections | The next route's JS chunk on hover or idle |
<link rel="preconnect" href="https://img.example-cdn.com">
<link rel="preload" href="/hero.avif" as="image" fetchpriority="high">
<link rel="preload" href="/fonts/brand.woff2" as="font" type="font/woff2" crossorigin>
<link rel="modulepreload" href="/assets/app-3f9a.js">
<link rel="prefetch" href="/assets/checkout-81bc.js">
as is mandatory for preload. It sets the priority, the Accept header and CSP checks. A missing or mismatched as, or mismatched crossorigin, means the cache entry isn't reused and the resource downloads twice.<img> or <script> near the top is usually pointless. The preload scanner already finds it.imagesrcset and imagesizes on the <link>.preconnect to an origin that serves fonts or other CORS fetches needs crossorigin, because anonymous and credentialed requests use separate connections.<link> hintsLink: <...>; rel=preload headers in an interim response while the real HTML is still being generated, so the browser can preconnect and preload during server think-time. Chromium supports preload and preconnect from Early Hints; check other browsers.<script type="speculationrules"> block declares URLs to prefetch or fully prerender, with an eagerness setting such as moderate (on hover). Prerendering can make navigations feel instant, but the page runs before the user arrives, so analytics and side effects must wait for document.prerendering to end.navigator.connection.saveData where it's available.as and crossorigin double-download trap.Spotted a mistake or a rights concern? Report an issue