Back
Web Fundamentals

Resource Hints: Preload, Prefetch & Preconnect

On this page

mediumPerformance

Resource Hints: Preload, Prefetch & Preconnect

TL;DRpreload = critical now • prefetch = likely next • preconnect = early connection setup
High Signal
Google
Meta
Netflix
Agoda
30-Second Answerstart every interview with this

Resource hints tell the browser how to prioritize network requests. Preload fetches critical assets for the current page, prefetch loads likely future resources, and preconnect warms up important origins early. Used correctly, they significantly improve LCP and overall loading performance.

Preload = first-class passengers who must board immediately (critical fonts, hero image). Prefetch = standby passengers for the next flight (likely next page). Preconnect = ground crew preparing the gate early for important destinations.

Identify Critical Resources
Preload (Current Page)
Prefetch (Next Likely Page)
Preconnect (External Origins)

1Preload – Critical Resources

Tells the browser to fetch important assets with high priority for the current navigation. Ideal for LCP images, critical fonts, and essential JS/CSS.

head.htmlhtml
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/hero.webp" as="image">

2Prefetch – Future Resources

Low-priority hint for resources likely needed in the near future (next page, heavy components). Browser may skip under network pressure.

3Preconnect & DNS-Prefetch

Preconnect establishes early DNS + TCP + TLS for important third-party domains. DNS-prefetch is a lighter DNS-only version.

Propertypreloadprefetchpreconnect
RiskCan compete with other critical requests if overusedMay be ignored under contentionToo many can waste connections
ExamplesHero image, Critical font, Critical CSSNext page JS, Dashboard dataapi.example.com, fonts.googleapis.com
PriorityHighLow / SpeculativeMedium
Use CaseCurrent page critical assetsLikely next navigationExternal APIs & CDNs

preload

Risk

Can compete with other critical requests if overused

Examples

Hero image, Critical font, Critical CSS

Priority

High

Use Case

Current page critical assets

prefetch

Risk

May be ignored under contention

Examples

Next page JS, Dashboard data

Priority

Low / Speculative

Use Case

Likely next navigation

preconnect

Risk

Too many can waste connections

Examples

api.example.com, fonts.googleapis.com

Priority

Medium

Use Case

External APIs & CDNs

Common questions

  • ›“What is the difference between preload and prefetch?”
  • ›“How do you optimize LCP with resource hints?”
  • ›“When should you use preconnect?”
  • ›“How do resource hints affect Core Web Vitals?”

What interviewers look for

  • Clear understanding of priority and timing
  • Knowledge of correct attributes (as, crossorigin)
  • Awareness of trade-offs and over-use risks
  • Connection to real metrics (LCP, TTFB)

Short answer (60 sec)

Preload critical assets for the current page (high priority). Prefetch likely future resources (low priority). Preconnect to important third-party origins early. Use sparingly and validate impact.

Detailed answer (senior level)

Resource hints give the browser explicit loading instructions. Preload is high-priority for current navigation and directly helps LCP. Prefetch is speculative for next actions. Preconnect warms up cross-origin connections. Always include proper 'as' attributes and crossorigin for fonts. Overusing hints can hurt performance by saturating bandwidth — measure with real-user data.

  • Preloading too many resources (bandwidth contention)
  • Missing 'as' attribute on preload
  • Forgetting crossorigin on fonts
  • Using prefetch for critical current-page resources
  • Not measuring impact after adding hints
Key Takeaways
  • ✓Preload critical resources needed for current page
  • ✓Prefetch for likely next navigation
  • ✓Preconnect to important external domains
  • ✓Always specify 'as' and crossorigin where needed
  • ✓Hints are priority signals — use them judiciously
  • ✓Validate with Lighthouse and real-user metrics
  • ✓Combine with critical CSS and lazy loading for best results

Related web fundamentals topics

Continue with closely related browser and frontend engineering concepts.

Lazy Loading: Load Resources On-DemandText Compression: Gzip and BrotliTree Shaking: Eliminate Dead Code from Your BundleImage & Video Optimization: Modern Formats & TechniquesCode Splitting: Optimize Bundle Size with Dynamic ImportsAdaptive Loading: Optimize for Device & Network
Previous TopicLazy Loading: Load Resources On-DemandNext Topic Text Compression: Gzip and Brotli