Using Prefetch and Preconnect to Speed Up Loading
Learn how prefetch, preconnect, dns-prefetch and preload work, when to use each resource hint, and how to avoid common performance mistakes.
Introduction
Prefetch, preconnect and related resource hints help browsers prepare important resources earlier. They can reduce waiting time for fonts, APIs, CDNs, scripts and likely next-page navigation when used correctly.
But resource hints are not magic speed buttons. If you preload the wrong files, preconnect to too many domains or prefetch pages users never visit, you can waste bandwidth and compete with more important resources. The goal is to prioritize what matters most.
Quick answer
Use preconnect for critical third-party domains needed on the current page, dns-prefetch for lower-priority domain lookup preparation, preload for critical current-page resources such as hero images or fonts, and prefetch for likely future navigation. Avoid applying resource hints to every asset or every external domain.
Resource hints
Prefetch and preconnect are browser resource hints. They tell the browser that certain resources or domains may be needed soon.
Resource hints can help the browser:
- resolve DNS earlier
- open a connection earlier
- prepare TLS earlier
- fetch important resources earlier
- prepare likely next-page resources
- reduce waiting time for critical assets
The browser may choose how aggressively to use these hints depending on network, device, priority and current page load.
Hint types
dns-prefetch
Resolves a domain name early.
preconnect
Resolves DNS, opens connection and prepares TLS early.
preload
Downloads a current-page critical resource earlier.
prefetch
Downloads a likely future resource or page with low priority.
prerender
Loads a likely future page in advance. Powerful but should be used carefully.
These hints solve different problems. Do not use them interchangeably.
Preconnect
Preconnect tells the browser to set up an early connection to a domain before the resource is requested.
Good candidates:
- font provider domain
- critical API domain
- CDN used for important assets
- payment provider required on checkout
- analytics/tag domain only if truly critical
- image CDN used above the fold
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Use preconnect only for important domains needed soon. Too many preconnects can waste connections and hurt performance.
DNS prefetch
DNS prefetch is lighter than preconnect. It tells the browser to resolve a domain name early without opening a full connection.
Good candidates:
- lower-priority third-party domains
- domains used later on the page
- external resources that are useful but not critical
- analytics or social domains that do not need immediate connection setup
<link rel="dns-prefetch" href="//example-cdn.com">
DNS prefetch is cheaper than preconnect, but it still should not be added for every possible external domain.
Preload
Preload tells the browser to fetch a current-page resource earlier because it is important for rendering the page.
Good candidates:
- main hero image
- critical font file
- above-the-fold CSS
- important script needed early
- key background image if it affects LCP
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
Preload should be reserved for resources that are definitely needed on the current page. Preloading unused files wastes bandwidth.
Prefetch
Prefetch is for likely future navigation, not critical current-page rendering.
Good candidates:
- next page in a multi-step flow
- likely next article
- checkout step after cart
- dashboard page after login
- search results after typing
- next route in a web app
<link rel="prefetch" href="/pricing">
Prefetch is lower priority than preload. It should not be used for resources required immediately on the current page.
Which hint to use
Need to resolve a domain early
- Use: dns-prefetch
Need to open a third-party connection early
- Use: preconnect
Need a critical current-page file sooner
- Use: preload
Need likely next-page resources
- Use: prefetch
Need to load a full likely next page
- Use: prerender, carefully
When unsure, start with fewer hints and measure the impact.
Why this matters
Resource hints matter because browsers cannot load everything at once with equal priority. The browser must decide which connections and files are most important. Good hints help the browser make better early decisions.
Bad hints can do the opposite: they can waste network capacity, delay critical files, increase memory usage or make performance less predictable on mobile connections.
How to check hints
Use HTTP Header Checker, browser developer tools and performance testing to verify resource hints.
Check:
- Page source — look for link rel="preconnect", rel="dns-prefetch", rel="preload" and rel="prefetch".
- Network tab — confirm hinted resources are requested at the expected time.
- Priority — check whether important assets are prioritized correctly.
- Console warnings — look for unused preload warnings.
- Third-party domains — confirm only important domains use preconnect.
- Mobile testing — check whether hints help or hurt on slower networks.
- Core Web Vitals — measure whether LCP, INP or overall load improves.
Check page headers
Use HTTP Header Checker to review response headers alongside resource hints in your page HTML.
Check page HTML for hints:
View page source and search for:
rel="preconnect"
rel="dns-prefetch"
rel="preload"
rel="prefetch"
Browser DevTools:
- Open Network tab
- Reload the page
- Check Initiator and Priority
- Look for preloaded resources
- Watch for unused preload warnings
- Compare before/after LCP
Command-line check:
curl -s https://example.com | grep -i "preload\|preconnect\|prefetch\|dns-prefetch"
Command-line checks can show HTML hints, but browser developer tools are better for understanding priority, timing and actual usage.
Common problems
Too many preconnects
MediumThe browser opens connections that may not be needed immediately.
Next step: Keep preconnect for only the most important early third-party domains.
Preload used for non-critical files
MediumUnimportant resources compete with critical content.
Next step: Preload only current-page resources needed early.
Unused preload warning
LowA preloaded resource was not used soon after page load.
Next step: Remove the preload or use the correct resource/type.
Missing crossorigin on fonts
MediumPreloaded fonts may be fetched twice if crossorigin is missing.
Next step: Add crossorigin where required for font preloads.
Wrong as attribute
MediumThe browser cannot prioritize the resource correctly.
Next step: Use correct as value, such as font, image, script, style or fetch.
Prefetch used for current-page assets
MediumPrefetch is too low priority for resources needed now.
Next step: Use preload for critical current-page resources.
Preconnect to low-value domains
LowConnections are prepared for domains that do not affect early rendering.
Next step: Use dns-prefetch or remove the hint.
Hints added globally without page context
MediumEvery page loads hints that only matter on some pages.
Next step: Add resource hints only where they are useful.
Hero image not prioritized
MediumThe main visible image loads too late.
Next step: Consider responsive image optimization and preload only the correct hero image.
Third-party scripts still slow page
MediumPreconnect helps connection setup but does not reduce script execution cost.
Next step: Delay, defer or remove non-critical third-party scripts.
How to use hints safely
-
Step 1: Identify the bottleneck
Check whether delay comes from DNS, connection setup, critical resource discovery or next-page navigation.
-
Step 2: Start with critical domains
Use preconnect only for important third-party domains needed early.
-
Step 3: Use dns-prefetch for lower-priority domains
Prepare DNS lookup without opening full connections.
-
Step 4: Preload critical current-page resources
Use preload for hero image, critical font or key file needed early.
-
Step 5: Prefetch likely future pages
Use prefetch only for likely next navigation, not required current-page assets.
-
Step 6: Use correct attributes
Set as, type and crossorigin correctly where needed.
-
Step 7: Avoid global overuse
Do not add the same hints to every page unless they matter everywhere.
-
Step 8: Measure before and after
Compare performance on desktop, mobile and slower network conditions.
Preconnect can help with third-party connection setup, but it cannot remove the cost of running third-party JavaScript.
- Use carefully for: payment providers, essential API domains, critical font providers, required CDN domains.
- Be careful with: ads, chat widgets, heatmaps, social embeds, multiple tag managers, non-critical analytics, A/B testing scripts.
For third-party scripts, delaying or removing the script may help more than preconnect.
WordPress themes and plugins may add resource hints automatically.
- performance plugin settings
- theme-added preloads
- Google Fonts hints
- page builder resource hints
- cache plugin optimization
- CDN plugin settings
- duplicate preconnect links
- unused preload warnings
- hints that appear on every page unnecessarily
Do not enable every performance-plugin preload option at once. Measure changes and remove hints that do not help.
DNS prefetch:
<link rel="dns-prefetch" href="//cdn.example.com">
Preconnect:
<link rel="preconnect" href="https://cdn.example.com" crossorigin>
Preload CSS:
<link rel="preload" href="/assets/app.css" as="style">
Preload font:
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
Preload hero image:
<link rel="preload" href="/images/hero.webp" as="image">
Prefetch likely next page:
<link rel="prefetch" href="/pricing">
Examples are illustrative. Use resource hints only for resources that are truly important for your page or likely next navigation.
Fonts
Fonts are common candidates for preconnect and preload because they can delay text rendering.
For external font providers:
- preconnect to font domains used early
- preload only critical font files
- use crossorigin when required
- limit font families and weights
- use font-display where appropriate
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" href="/fonts/inter-regular.woff2" as="font" type="font/woff2" crossorigin>
Do not preload every font weight. Preload only the most important font files used above the fold.
The Largest Contentful Paint element is often a hero image or large above-the-fold image.
Possible improvements:
- use correct mobile/desktop image sizes
- compress images
- use modern formats
- preload the actual LCP image when needed
- avoid preloading hidden desktop image on mobile
- avoid preloading multiple competing hero images
- set width and height
- use fetchpriority where appropriate if supported
Preloading the wrong image can make LCP worse by stealing bandwidth from the right image.
Frequently asked questions
What is preconnect?
Preconnect prepares DNS, connection and TLS setup for an important external domain before it is needed.
What is dns-prefetch?
DNS prefetch resolves a domain early without opening a full connection.
What is preload?
Preload fetches a critical current-page resource earlier.
What is prefetch?
Prefetch prepares resources or pages likely needed for future navigation.
Can resource hints make a site slower?
Yes. Too many hints or wrong hints can waste bandwidth and compete with important resources.
Should I preload every image and font?
No. Preload only resources that are critical for the current page.
What should I optimize first?
Start with the main above-the-fold resource, critical fonts and important third-party domains. Measure before adding more hints.
Related tools
Use these free tools to verify your configuration after applying changes.
Related guides
Browse all Website Health guides →Need help applying this fix?
Send us your domain, report link or issue details. CheckDomainHealth will review the request and route it to the right technical team if hands-on support is needed.
Was this guide helpful?
Your feedback helps us improve our guides for everyone.
Thanks for your feedback!