References

Beginner-friendly references for web development, with live, editable examples.

The HTML fetchpriority attribute

Attribute All modern browsers
In short

The HTML fetchpriority attribute hints whether the browser should fetch an image, script or link early or late. Its values are high, low and auto, as in <img src="hero.jpg" fetchpriority="high" alt="Harbor">, and the effect varies by browser.

Overview

The HTML fetchpriority attribute tells the browser how urgent a fetch is relative to others of the same kind. It goes on <img>, <link> and <script> elements and takes high, low or auto. A missing or unknown value counts as auto, the default.

It is a hint rather than a rule. Both the browser's internal priority for a fetch and the effect of fetchpriority on it are entirely browser dependent.

In Chrome, an image without the attribute starts at Low or Medium, and one in the viewport can be raised to High. Marked high, it starts at High, and marked low, it stays at Low even in view.

The attribute covers the element's own fetch. On a link it sets the priority of the linked resource, such as a preload or a stylesheet. On a script it sets the initial fetch only and doesn't affect module imports.

Syntax

<img src="hero.avif" alt="Harbor at sunrise" fetchpriority="high">
<link rel="preload" href="hero.avif" as="image" fetchpriority="high">
<script async src="chat.js" fetchpriority="low"></script>

Values

Value
auto (default) | high | low

Example

Live example
<div class="carousel">
  <img src="harbor.avif" alt="Harbor at sunrise" width="1200" height="600" fetchpriority="high">
  <img src="pier.avif" alt="Boats at the pier" width="1200" height="600" fetchpriority="low">
  <img src="market.avif" alt="Fish market at dusk" width="1200" height="600" fetchpriority="low">
</div>
<script async src="chat-widget.js" fetchpriority="low"></script>

Best practices

  • Set fetchpriority="high" on the image behind the page's Largest Contentful Paint. Pair it with a preload link for that image to start the fetch early as well.
  • Use the attribute sparingly. Excessive or incorrect prioritization can degrade performance.
  • Mark images that start off screen, such as later carousel slides, with fetchpriority="low" to signal that they can wait behind other images.
  • Give an async script fetchpriority="high" only when the first view needs it. In Chrome, async scripts start at Low priority unless they are marked high.

Frequently asked questions

How does fetchpriority change loading?
The fetchpriority attribute hints whether a resource should be fetched before or after others of the same kind.
Does fetchpriority=high make an image load faster?
Setting fetchpriority to high can make an image arrive sooner, because it lets the browser raise the image's priority. The effect depends on the browser, since the attribute is only a hint.
Does fetchpriority replace preload?
No, a preload link is what starts a fetch early, and fetchpriority hints at how urgent that fetch is. A preload link takes its own priority from its fetchpriority value, so put the attribute on the link itself.
Which JavaScript property matches fetchpriority?
The fetchPriority property on img, link and script elements reflects the attribute, and fetch() takes a priority option. Chrome and Edge 101 named the property fetchpriority, in lowercase.
How widely is fetchpriority supported?
All current engines support fetchpriority, from Chrome and Edge 101, Firefox 132 and Safari 17.2. Those versions cover img, link and script, and older browsers ignore the attribute.