--- url: "https://web.dev/articles/preload-responsive-images" titulek: "Preload responsive images | Articles | web.dev" h1: "Preload responsive images Stay organized with collections Save and categorize content based on your preferences." popis: "Learn about new and exciting possibilities for preloading responsive images to ensure great user experience." jazyk: "en" kanonicka: "https://web.dev/articles/preload-responsive-images" drobecky: ["Articles", "Preload responsive images"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 00:05:05" znaku: 11097 slov: 1460 kodovani: "iso-8859-2" sha256: "894a4b87209c89efef7dc6f828e55d66c2f9c7540d88bee0e351b768854d6e2a" --- Preload responsive images Stay organized with collections Save and categorize content based on your preferences. Barry Pollard Yoav Weiss Published: September 30, 2019, Last updated: July 10, 2026 You can preload responsive images, which can let your images load significantly faster by helping the browser identify the correct image from a `srcset` before it renders the `img` tag. Responsive images overview Browser Support 73 79 78 17.2 [Source](https://developer.mozilla.org/docs/Web/API/HTMLLinkElement/imageSrcset) Suppose you're browsing the web on a screen that's 300 pixels wide, and the page requests an image 1500 pixels wide. That page has wasted a lot of your mobile data because your screen can't do anything with all that extra resolution. Ideally, the browser would fetch a version of the image that's just a *little* wider than your screen size, for example, 325 pixels. This ensures a high-resolution image without wasting data, and lets the image load faster. [Responsive images](/articles/serve-responsive-images#serve_multiple_image_versions) let browsers fetch different image resources for different devices. If you don't use an [image CDN](/articles/image-cdns), save multiple dimensions for each image and specify them in the `srcset` attribute. The `w` value tells the browser the width of each version, so it can choose the appropriate version for any device: `…` Preload overview Browser Support 50 79 85 11.1 [Source](https://developer.mozilla.org/docs/Web/HTML/Reference/Attributes/rel/preload) [Preloading](/articles/preload-critical-assets) lets you tell the browser about critical resources that you want to load as soon as possible, before they're discovered in HTML. This is especially useful for resources that aren't readily discoverable, such as fonts included in stylesheets, background images, or resources loaded from a script. `` `imagesrcset` and `imagesizes` The `` element uses the `imagesrcset` and `imagesizes` attributes to preload responsive images. Use them alongside ``, with the `srcset` and `sizes` syntax used in the `` element. For example, if you want to preload a responsive image specified with: `A rad wolf` You can do that by adding the following to your HTML's ``: `` This initiates a request using the same resource selection logic that `srcset` and `sizes` use. Use cases The following are some use cases for preloading responsive images. Preload dynamically-injected responsive images Imagine you're dynamically-loading hero images as part of a slideshow, and you know which image will be displayed first. In that case, you probably want to show that image as soon as possible, and not wait for the slideshow script to load it. You can inspect this issue on a website with a dynamically-loaded image gallery: Open this [slideshow demo](https://responsive-preload.glitch.me/no_preload.html) in a new tab. Press `Control+Shift+J` (or `Command+Option+J` on Mac) to open DevTools. Click the **Network** tab. In the **Throttling** drop-down list, select **Fast 3G**. Disable the **Disable cache** checkbox. Reload the page. Without preloading, the images start loading after the browser has finished running the script. For the first image, that delay is unnecessary. Using `preload` here lets the image start loading ahead of time, so it can be ready to display when the browser needs to display it. Preloading the first image lets it start loading at the same time as the script. To see the difference that preloading makes, inspect the same dynamically-loaded image gallery but [with the first image preloaded](https://responsive-preload.glitch.me/preload.html) by following the steps from the first example. Preload background images using image-set If you have different background images for different screen densities, you can specify them in your CSS with the `image-set` syntax. The browser can then choose which one to display based on the screen's [DPR](https://developer.mozilla.org/docs/Web/API/Window/devicePixelRatio). `background-image: image-set( "cat.png" 1x, "cat-2x.png" 2x);` The problem with CSS background images is that the browser discovers them only after it has downloaded and processed all the CSS in the page's ``. You can inspect this issue on an example website with a [responsive background image](https://responsive-preload.glitch.me/background_no_preload.html). In this example, the image download doesn't start until the CSS is fully downloaded, causing unnecessary lag to the image's display. Responsive image preloading lets you load those images faster. `` Leaving out the `href` attribute lets you ensure that browsers that don't support `imagesrcset` on the `` element, but do support `image-set` in CSS download the correct source. However, they won't benefit from the preload in this case. You can inspect how the previous example behaves with a preloaded responsive background image in [the responsive background preload demo](https://responsive-preload.glitch.me/background_preload.html). Here the image and CSS start downloading at the same time, letting the image load faster. Practical effects of preloading responsive images Preloading your responsive images can speed them up in theory, but what does it do in practice? To answer that I created two copies of a [demo PWA shop](https://github.com/GoogleChromeLabs/sample-pie-shop): [one that doesn't preload images](https://20190710t144416-dot-pie-shop-app.appspot.com/apparel), and [one that preloads some of them](https://20190710t132936-dot-pie-shop-app.appspot.com/apparel). Because the site lazy loads images using JavaScript, it's likely to benefit from preloading the ones that appear in the initial viewport. That produced the following results for [no preload](https://www.webpagetest.org/result/190710_VM_30b9d4c993a1e60befba17e1261ba1ca/) and for [image preload](https://www.webpagetest.org/result/190710_7B_a99e792121760f81a270b4b9c847797b/): [Start Render](https://github.com/WPO-Foundation/webpagetest-docs/blob/main/src/getting-started.md#start-render) stayed the same. [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index) improved slightly (273 ms, as images arrive faster don't take up a huge chunk of the pixel area). [Last Painted Hero](https://github.com/WPO-Foundation/webpagetest/blob/master/docs/Metrics/HeroElements.md) improved significantly, by 1.2 seconds. Images arrive significantly faster when preloaded, greatly improving the user experience. Preload and `` The Web Performance Working Group is discussing adding a preload equivalent for `srcset` and `sizes`, but not the [``](https://developer.mozilla.org/docs/Web/HTML/Element/picture) element, which handles the ["art direction"](/articles/codelab-art-direction) use case. There are still a number of [technical issues to sort out](https://calendar.perfplanet.com/2018/how-the-sausage-is-made-webperfwg-meeting-summary/) for preloading ``, but in the meantime, there are workarounds: ` ` The `` element's image source selection logic goes over the `media` attributes of the `` elements in order, finds the first one that matches, and uses the attached resource. Because responsive preload has no notion of "order" or "first match", you'll need to translate the breakpoints into something like the following: ` ` Preload and `type` The `` element also supports matching on the first `type`, to let you provide different image formats so the browser can pick the first image format it supports. This use case is only partially supported with preload: browsers should only download preloads for supported types. So you can use this to prevent browsers preloading unsupported mimetypes types by including this in the preload: `` However, unlike `` it won't stop at the first supported type. So if multiple preloads are included for multiple types, then all the images will be preloaded: Don't do this — preload multiple types: ` ` Instead do this — preload the most preferred type: `` Preloading the newest format (AVIF in this case) acts as as a progressive enhancement, where browsers supporting that type will benefit and other browsers won't benefit from the preload. For sites where the image is quickly discoverable in the HTML, we recommend avoiding preload, and instead having the [preload scanner](/articles/preload-scanner) pick up the images from the `` and `` elements instead. This is a best practice anyway, especially when using [Fetch Priority](/articles/fetch-priority) for help prioritizing the appropriate image, as it allows the exact image to be preloaded based on browser support. It also removes the risk of a preload becoming outdated from the main markup when images or pages change. Effects on Largest Contentful Paint (LCP) Because images can be [Largest Contentful Paint (LCP) candidates](/articles/lcp#what-elements-are-considered), preloading them can improve your website's LCP. Regardless of whether the image you're preloading is responsive, preloads work best when the image resource isn't discoverable in the initial markup payload. You'll also get more LCP improvement on sites that render markup on the client side than on sites that send complete markup from the server. Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2026-07-10 UTC.