Click Below to Get the Code

Browse, clone, and build from real-world templates powered by Harper.
Tutorial
GitHub Logo

Resource Hints Explained | Preload, Preconnect, and Early Hints

Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.
Tutorial

Resource Hints Explained | Preload, Preconnect, and Early Hints

By
Joseph Yoo
June 4, 2025
By
Joseph Yoo
June 4, 2025
By
Joseph Yoo
June 4, 2025
June 4, 2025
Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.
Joseph Yoo
Forward Deployed Engineer

Resource hints like preload, preconnect, and early hints are essential tools for improving web performance, particularly when optimizing for metrics like LCP (Largest Contentful Paint) and TTFB (Time to First Byte). In this article, we walk through real-world examples, demonstrating the measurable impact of each hint.

Baseline: No Resource Hint

HTML File: no-preload.html
JavaScript File: loader.js

This setup loads an HTML file, which loads a JavaScript file, which then loads an image. Each step incurs its own latency.

<!-- no-preload.html -->
<html>
  <head></head>
  <body>
    <script src="../javascript/loader.js"></script>
  </body>
</html>

// loader.js
const img = new Image();
img.src = "../images/background.png";
document.body.appendChild(img);

Impact: Each asset waits for the previous to load before it begins, compounding latency.

Client-Side Preload

HTML File: client-preload.html

By adding a <link rel="preload"> tag, we instruct the browser to fetch the image early—even before the JS requests it.

<link rel="preload" as="image" href="../images/background.png" />
<script src="../javascript/loader.js"></script>

Impact: The browser downloads the image in parallel with the JS file, saving one round-trip time.

Early Hints Preload

HTML File: eh-preload.html

This version moves the preload hint to the server using an HTTP 103 Early Hints response:

HTTP/1.1 103 Early Hints
Link: </images/background.png>; rel=preload; as=image

HTTP/1.1 200 OK
Content-Type: text/html

Impact: Resources start loading before the full response even arrives, outperforming client-side preload.

Client-Side Preconnect

HTML File: client-preconnect.html
JavaScript File: cdn-loader.js

In cases where only the domain of a resource is known, use preconnect:

<link rel="preconnect" href="https://cdn.example.com" />
<script src="https://cdn.example.com/cdn-loader.js"></script>
// cdn-loader.js
const img = new Image();
img.src = "https://img.example.com/background.png";
document.body.appendChild(img);

Impact: Reduces DNS, TCP, and TLS setup times for third-party resources, typically saving 100–300ms.

Early Hints Preconnect

HTML File: eh-preconnect.html

Move the preconnect instruction to the server to get the benefits even earlier:

HTTP/1.1 103 Early Hints
Link: <https://cdn.example.com>; rel=preconnect
Link: <https://img.example.com>; rel=preconnect

HTTP/1.1 200 OK

Impact: Provides the most aggressive latency reduction for third-party connections.

Key Takeaways

Focus your resource hints on LCP-contributing elements like large images, web fonts, or hero banners, and wherever possible, leverage Early Hints for the best performance. These optimizations not only improve load time and user experience but also contribute to higher search engine rankings. Just remember, more isn’t always better. Target only the assets that impact the initial user experience to avoid unnecessary overhead.

Resource hints like preload, preconnect, and early hints are essential tools for improving web performance, particularly when optimizing for metrics like LCP (Largest Contentful Paint) and TTFB (Time to First Byte). In this article, we walk through real-world examples, demonstrating the measurable impact of each hint.

Baseline: No Resource Hint

HTML File: no-preload.html
JavaScript File: loader.js

This setup loads an HTML file, which loads a JavaScript file, which then loads an image. Each step incurs its own latency.

<!-- no-preload.html -->
<html>
  <head></head>
  <body>
    <script src="../javascript/loader.js"></script>
  </body>
</html>

// loader.js
const img = new Image();
img.src = "../images/background.png";
document.body.appendChild(img);

Impact: Each asset waits for the previous to load before it begins, compounding latency.

Client-Side Preload

HTML File: client-preload.html

By adding a <link rel="preload"> tag, we instruct the browser to fetch the image early—even before the JS requests it.

<link rel="preload" as="image" href="../images/background.png" />
<script src="../javascript/loader.js"></script>

Impact: The browser downloads the image in parallel with the JS file, saving one round-trip time.

Early Hints Preload

HTML File: eh-preload.html

This version moves the preload hint to the server using an HTTP 103 Early Hints response:

HTTP/1.1 103 Early Hints
Link: </images/background.png>; rel=preload; as=image

HTTP/1.1 200 OK
Content-Type: text/html

Impact: Resources start loading before the full response even arrives, outperforming client-side preload.

Client-Side Preconnect

HTML File: client-preconnect.html
JavaScript File: cdn-loader.js

In cases where only the domain of a resource is known, use preconnect:

<link rel="preconnect" href="https://cdn.example.com" />
<script src="https://cdn.example.com/cdn-loader.js"></script>
// cdn-loader.js
const img = new Image();
img.src = "https://img.example.com/background.png";
document.body.appendChild(img);

Impact: Reduces DNS, TCP, and TLS setup times for third-party resources, typically saving 100–300ms.

Early Hints Preconnect

HTML File: eh-preconnect.html

Move the preconnect instruction to the server to get the benefits even earlier:

HTTP/1.1 103 Early Hints
Link: <https://cdn.example.com>; rel=preconnect
Link: <https://img.example.com>; rel=preconnect

HTTP/1.1 200 OK

Impact: Provides the most aggressive latency reduction for third-party connections.

Key Takeaways

Focus your resource hints on LCP-contributing elements like large images, web fonts, or hero banners, and wherever possible, leverage Early Hints for the best performance. These optimizations not only improve load time and user experience but also contribute to higher search engine rankings. Just remember, more isn’t always better. Target only the assets that impact the initial user experience to avoid unnecessary overhead.

Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.

Download

White arrow pointing right
Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.

Download

White arrow pointing right
Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.

Download

White arrow pointing right

Explore Recent Resources

News
GitHub Logo

Harper 5.0 Is Here: Open Source, RocksDB, and a Runtime Built for the Agentic Era

Harper 5.0 launches with a fully open-source core under Apache 2.0, RocksDB as a native storage engine alongside LMDB, and source-available Harper Pro. This release delivers a unified runtime purpose-built for agentic engineering, from prototype to production.
Product Update
News
Harper 5.0 launches with a fully open-source core under Apache 2.0, RocksDB as a native storage engine alongside LMDB, and source-available Harper Pro. This release delivers a unified runtime purpose-built for agentic engineering, from prototype to production.
Person with short dark hair and moustache, wearing a colorful plaid shirt, smiling outdoors in a forested mountain landscape.
Aleks Haugom
Senior Manager of GTM & Marketing
News

Harper 5.0 Is Here: Open Source, RocksDB, and a Runtime Built for the Agentic Era

Harper 5.0 launches with a fully open-source core under Apache 2.0, RocksDB as a native storage engine alongside LMDB, and source-available Harper Pro. This release delivers a unified runtime purpose-built for agentic engineering, from prototype to production.
Aleks Haugom
Apr 2026
News

Harper 5.0 Is Here: Open Source, RocksDB, and a Runtime Built for the Agentic Era

Harper 5.0 launches with a fully open-source core under Apache 2.0, RocksDB as a native storage engine alongside LMDB, and source-available Harper Pro. This release delivers a unified runtime purpose-built for agentic engineering, from prototype to production.
Aleks Haugom
News

Harper 5.0 Is Here: Open Source, RocksDB, and a Runtime Built for the Agentic Era

Harper 5.0 launches with a fully open-source core under Apache 2.0, RocksDB as a native storage engine alongside LMDB, and source-available Harper Pro. This release delivers a unified runtime purpose-built for agentic engineering, from prototype to production.
Aleks Haugom
Podcast
GitHub Logo

Maintaining Momentum: Versioning, Stability & the Road to Nuxt 5 with Daniel Roe

In this podcast episode, Daniel Roe, lead of the Nuxt framework, shares insights on Nuxt 3, 4, and the upcoming Nuxt 5 release. We discuss open-source development, upgrading Nuxt apps, Vue-powered full-stack web apps, version maintenance, and the future of modern web development.
Select*
Podcast
In this podcast episode, Daniel Roe, lead of the Nuxt framework, shares insights on Nuxt 3, 4, and the upcoming Nuxt 5 release. We discuss open-source development, upgrading Nuxt apps, Vue-powered full-stack web apps, version maintenance, and the future of modern web development.
Person with short hair wearing a light blue patterned shirt, smiling widely outdoors with blurred greenery and trees in the background.
Austin Akers
Head of Developer Relations
Podcast

Maintaining Momentum: Versioning, Stability & the Road to Nuxt 5 with Daniel Roe

In this podcast episode, Daniel Roe, lead of the Nuxt framework, shares insights on Nuxt 3, 4, and the upcoming Nuxt 5 release. We discuss open-source development, upgrading Nuxt apps, Vue-powered full-stack web apps, version maintenance, and the future of modern web development.
Austin Akers
Apr 2026
Podcast

Maintaining Momentum: Versioning, Stability & the Road to Nuxt 5 with Daniel Roe

In this podcast episode, Daniel Roe, lead of the Nuxt framework, shares insights on Nuxt 3, 4, and the upcoming Nuxt 5 release. We discuss open-source development, upgrading Nuxt apps, Vue-powered full-stack web apps, version maintenance, and the future of modern web development.
Austin Akers
Podcast

Maintaining Momentum: Versioning, Stability & the Road to Nuxt 5 with Daniel Roe

In this podcast episode, Daniel Roe, lead of the Nuxt framework, shares insights on Nuxt 3, 4, and the upcoming Nuxt 5 release. We discuss open-source development, upgrading Nuxt apps, Vue-powered full-stack web apps, version maintenance, and the future of modern web development.
Austin Akers
Blog
GitHub Logo

Most LLM Calls Are Waste. Here's the Math.

Semantic caching for LLMs can reduce API costs by 20–70% by reusing similar responses. Combined with deterministic routing and improved retrieval, enterprises can significantly lower LLM usage, though effectiveness varies by workload and improves over time.
Blog
Semantic caching for LLMs can reduce API costs by 20–70% by reusing similar responses. Combined with deterministic routing and improved retrieval, enterprises can significantly lower LLM usage, though effectiveness varies by workload and improves over time.
Person with short dark hair and moustache, wearing a colorful plaid shirt, smiling outdoors in a forested mountain landscape.
Aleks Haugom
Senior Manager of GTM & Marketing
Blog

Most LLM Calls Are Waste. Here's the Math.

Semantic caching for LLMs can reduce API costs by 20–70% by reusing similar responses. Combined with deterministic routing and improved retrieval, enterprises can significantly lower LLM usage, though effectiveness varies by workload and improves over time.
Aleks Haugom
Apr 2026
Blog

Most LLM Calls Are Waste. Here's the Math.

Semantic caching for LLMs can reduce API costs by 20–70% by reusing similar responses. Combined with deterministic routing and improved retrieval, enterprises can significantly lower LLM usage, though effectiveness varies by workload and improves over time.
Aleks Haugom
Blog

Most LLM Calls Are Waste. Here's the Math.

Semantic caching for LLMs can reduce API costs by 20–70% by reusing similar responses. Combined with deterministic routing and improved retrieval, enterprises can significantly lower LLM usage, though effectiveness varies by workload and improves over time.
Aleks Haugom
Blog
GitHub Logo

Build a Conversational AI Agent on Harper in 5 Minutes

Build a conversational AI agent in minutes using Harper’s unified platform. This guide shows how to create, deploy, and scale real-time AI agents with built-in database, vector search, and APIs—eliminating infrastructure complexity for faster development.
Blog
Build a conversational AI agent in minutes using Harper’s unified platform. This guide shows how to create, deploy, and scale real-time AI agents with built-in database, vector search, and APIs—eliminating infrastructure complexity for faster development.
A smiling man with a beard and salt-and-pepper hair stands outdoors with arms crossed, wearing a white button-down shirt.
Stephen Goldberg
CEO & Co-Founder
Blog

Build a Conversational AI Agent on Harper in 5 Minutes

Build a conversational AI agent in minutes using Harper’s unified platform. This guide shows how to create, deploy, and scale real-time AI agents with built-in database, vector search, and APIs—eliminating infrastructure complexity for faster development.
Stephen Goldberg
Apr 2026
Blog

Build a Conversational AI Agent on Harper in 5 Minutes

Build a conversational AI agent in minutes using Harper’s unified platform. This guide shows how to create, deploy, and scale real-time AI agents with built-in database, vector search, and APIs—eliminating infrastructure complexity for faster development.
Stephen Goldberg
Blog

Build a Conversational AI Agent on Harper in 5 Minutes

Build a conversational AI agent in minutes using Harper’s unified platform. This guide shows how to create, deploy, and scale real-time AI agents with built-in database, vector search, and APIs—eliminating infrastructure complexity for faster development.
Stephen Goldberg
Podcast
GitHub Logo

Inside PixiJS, AT Protocol, and Modern Game Development with Trezy Who

Trezy shares his journey from professional drummer and filmmaker to software engineer and open source maintainer. Learn about PixieJS, game development, AT Proto, BlueSky, data sovereignty, and how developers can confidently contribute to open source projects.
Select*
Podcast
Trezy shares his journey from professional drummer and filmmaker to software engineer and open source maintainer. Learn about PixieJS, game development, AT Proto, BlueSky, data sovereignty, and how developers can confidently contribute to open source projects.
Person with short hair wearing a light blue patterned shirt, smiling widely outdoors with blurred greenery and trees in the background.
Austin Akers
Head of Developer Relations
Podcast

Inside PixiJS, AT Protocol, and Modern Game Development with Trezy Who

Trezy shares his journey from professional drummer and filmmaker to software engineer and open source maintainer. Learn about PixieJS, game development, AT Proto, BlueSky, data sovereignty, and how developers can confidently contribute to open source projects.
Austin Akers
Mar 2026
Podcast

Inside PixiJS, AT Protocol, and Modern Game Development with Trezy Who

Trezy shares his journey from professional drummer and filmmaker to software engineer and open source maintainer. Learn about PixieJS, game development, AT Proto, BlueSky, data sovereignty, and how developers can confidently contribute to open source projects.
Austin Akers
Podcast

Inside PixiJS, AT Protocol, and Modern Game Development with Trezy Who

Trezy shares his journey from professional drummer and filmmaker to software engineer and open source maintainer. Learn about PixieJS, game development, AT Proto, BlueSky, data sovereignty, and how developers can confidently contribute to open source projects.
Austin Akers