Images: the largest item in page weight
PerformanceWhich dimensions, which format and which loading behaviour your images need so they do not slow the page down — and how to find the heaviest files in a few minutes.
10 min read
By Timo Wessels Published
Images are the biggest item in page weight on most websites, and the one that is easiest to shrink. Four things decide it:
- An image is not wider than the area in which it is shown.
- It exists in a modern format, that is WebP or AVIF.
- The browser loads only one version of it, not several.
- The large image in the visible area is loaded with priority instead of delayed, with fixed dimensions so that nothing jumps.
The most important points first:
- An image is not wider than the area in which it is shown.
- It exists as WebP or AVIF, and the browser loads only one version of it.
- The large image in the visible area loads at once and has fixed dimensions so that nothing jumps.
Why the images in particular?
The HTTP Archive measures millions of websites every year. In 2025 the median mobile home page carried 911 KB of images, plus 632 KB of JavaScript and 122 KB of fonts. Images are thus the biggest item. On inner pages it was only 354 KB of images on average, so the home page is usually the outlier.
On 76 percent of mobile pages an image is also the largest visible element while loading. The load-time metric LCP, the time to the largest visible content, is measured on that element.
Whoever wants to make a slow page faster therefore looks at the images first. Almost every image problem is a mixture of four mistakes:
- Wrong dimensions. The image is 4000 pixels wide and is shown in an area 800 pixels wide. The browser loads everything and scales it down.
- Old format. JPEG and PNG instead of WebP or AVIF.
- No compression. Even a WebP can be needlessly heavy.
- Several versions at once. Three variants of the same image stand in the HTML and are shown and hidden by CSS. All three are loaded.
The right dimensions
An image should not be wider than the area in which it is shown. For high-resolution screens the file may have correspondingly more pixels, but not arbitrarily many. The sensible widths come from your own layout: from the breakpoints and the maximum content width of your page, not from a general table.
For small images the same applies in the small. A product image that appears about the same size on all devices does not need three versions.
A note for collaboration: whoever orders images from a photographer or an agency should hand over the target widths straight away. Otherwise files come straight from the camera, and someone has to do the work a second time.
The right format
| Format | What for | What it brings |
|---|---|---|
| WebP | Photos and graphics, the standard choice | lossy 25 to 34 percent smaller than JPEG, lossless 26 percent smaller than PNG |
| AVIF | Photos where every kilobyte counts | according to MDN much better compression than PNG or JPEG |
| SVG | Logos, icons, diagrams | Vector graphic, scalable without loss |
| JPEG, PNG | Files to download, fallback version | — |
WebP is the safe standard choice: it is supported by all current browsers. AVIF compresses even more strongly and now also runs in all major browsers: Chrome since version 85, Firefox since 93, Safari since 16.1, Edge since 121. MDN still advises providing fallbacks for AVIF with the <picture> element.
How far the web still is from that is shown by the Web Almanac 2024: JPEG fell between 2022 and 2024 from 40 to 32 percent of all images, so it is still the most common format. WebP gained three percentage points, AVIF almost one. There are almost four times as many AVIF files as two years before. The Web Almanac judges: almost all JPEGs, PNGs and GIFs on the web would be better served by a modern format.
The conversion is best done in WordPress by a plugin that converts and compresses automatically on upload. That is more important than a one-off conversion of the existing stock. Otherwise in three months someone uploads a camera photo again, and the problem is back. That is my experience.
How heavy may an image be?
There is no fixed limit, but there is a yardstick. According to the Web Almanac 2024, the median image on the web weighs 12 KB. Most mobile pages also have an image of 135 KB or more. A large header image may lie above that, because it dominates the display. A file in the megabyte range, on the other hand, is almost always a sign that dimensions, format or compression are wrong.
Compare the file size not with a rule of thumb but with the display size: an image shown 800 pixels wide has no reason to be a 4000-pixel file.
Load only one version
For images that should be cropped differently on different devices there is the <picture> element. The browser goes through the <source> entries from top to bottom and takes the first one whose condition fits. Exactly one file is loaded:
<picture>
<source media="(max-width: 576px)"
srcset="workshop-576.webp"
width="576" height="576">
<source media="(max-width: 960px)"
srcset="workshop-960.webp"
width="960" height="770">
<img src="workshop-1920.webp"
width="1920" height="893"
alt="Workshop with two workstations">
</picture>
Two things that can go wrong:
- The order. Because the first hit counts, with
max-widthconditions the smallest breakpoint belongs at the top. If the widest condition comes first, it fits almost every device. - The
<img>at the end is mandatory. It describes the image, carries the alternative text and is the fallback if no<source>fits.
If the same image is only to be delivered in different resolutions without the crop changing, srcset with sizes directly on the <img> is enough. WordPress produces this automatically since version 4.4 for images from the media library. That is a good reason to embed images through the media library instead of linking them directly.
Delayed loading, except the main image
Images that become visible only after scrolling do not need to load at once:
<img src="reference.webp" loading="lazy" width="800" height="600" alt="…">
The exception is important: the large image in the visible area must not be loaded with delay. web.dev advises always loading images in the first visible area at once. Even so, according to the Web Almanac 2025, 16 to 17 percent of pages do that with their LCP image.
There the opposite is right, high loading priority:
<img src="header.webp" fetchpriority="high" width="1920" height="893" alt="…">
At Google Flights the LCP value fell with it in a test from 2.6 to 1.9 seconds. WordPress sets fetchpriority="high" itself since version 6.3 on the image it considers the LCP image, and leaves out delayed loading there. The mistake usually arises through plugins or page builders that set all images to delayed loading across the board. After every such installation check whether the header image is excluded.
Images and jumping layouts
Set width and height on every image. Not as a design instruction but as information for the browser: it calculates the aspect ratio from it and reserves the space before the image arrives. Without these details everything below jumps as soon as the image arrives. According to the Web Almanac 2025, 62 percent of mobile pages have at least one image without dimensions. The year before it was 66 percent.
So that the image stays flexible anyway:
img {
max-width: 100%;
height: auto;
}
The attributes reserve the space, the CSS makes the image adaptable.
A related case: content that appears later, such as notice bars, banners or ads loaded afterwards. If they occupy no space beforehand, they push everything down when they appear. web.dev advises reserving the space in advance, for example with min-height or with aspect-ratio.
The special case of background images
Images included by CSS as a background behave differently:
- They are not in the HTML and carry no alternative text. For decoration that is right, for images with content it is wrong.
- The browser discovers them later than images in the HTML. If a background image is the LCP element, according to web.dev it needs a
preload, best withfetchpriority="high". loading="lazy"does not work there. According to web.dev the attribute can only be used on<img>elements.
As a rule: decoration may be a background image. Content belongs in the HTML.
How to check it yourself
- The Network tab. Open the developer tools (F12), Network tab, filter “Img”, reload the page, sort by size. At the top are your problem images. There you also see whether several versions of the same image are loaded.
- The right-click. “Open image in new tab” shows the real dimensions. Compare them with the width in which the image appears on the page.
- PageSpeed Insights. Since Lighthouse 13 the former audit for wrongly sized images is part of the insight “Improve image delivery”. It lists the affected images with the possible saving.
- The throttling test. Set a slow connection in the Network tab and reload. In slow motion you see which image loads late and what shifts as a result.
- The media library. Go through it in WordPress for large files. Anything in the megabyte range is a candidate.
What you can do
- Set up automatic processing on upload: conversion to WebP or AVIF, compression, size variants. That prevents the problem from coming back.
- Take on the ten largest images, not all. Usually a few files make up most of the weight. That is my experience.
- Check the header image separately: suitable size,
fetchpriority="high", noloading="lazy", dimensions set. - Set
widthandheighteverywhere, especially on images from page builder blocks and hand-written HTML. - Tidy up the stock: duplicate uploads and images from pages that no longer exist. That makes the media library and the backup smaller.
And a correction of expectations: image optimisation is not a one-off task. It is a setting made right once, plus a habit with every new image. Without both, the website is back after a year of content care where it was before.
Sources
- HTTP Archive, Web Almanac 2025: Page Weight — 911 KB of images, 632 KB of JavaScript, 122 KB of fonts on the median mobile home page, 354 KB of images on inner pages: almanac.httparchive.org(external site: almanac.httparchive.org)
- HTTP Archive, Web Almanac 2025: Performance — image as LCP element, 16 to 17 percent lazy-loaded LCP images, 62 percent with images without dimensions: almanac.httparchive.org(external site: almanac.httparchive.org)
- HTTP Archive, Web Almanac 2024: Media — development of image formats, 12 KB and 135 KB, bits per pixel: almanac.httparchive.org(external site: almanac.httparchive.org)
- Google for Developers, An image format for the Web — WebP 25 to 34 percent smaller than JPEG, 26 percent smaller than PNG: developers.google.com(external site: developers.google.com)
- MDN, Image file type and format guide — AVIF, browser support, fallbacks, SVG for graphics: developer.mozilla.org(external site: developer.mozilla.org)
- MDN, The Picture element — choice of source, role of the
<img>: developer.mozilla.org(external site: developer.mozilla.org) - WordPress Core, Responsive Images in WordPress 4.4 — automatic
srcsetandsizes: make.wordpress.org(external site: make.wordpress.org) - web.dev, Browser-level image lazy loading — load images in the first area at once,
loadingonly on<img>: web.dev(external site: web.dev) - web.dev, Optimize resource loading with the Fetch Priority API — Google Flights 2.6 to 1.9 seconds,
preloadfor background images: web.dev(external site: web.dev) - WordPress Core, Image performance enhancements in WordPress 6.3 — automatic
fetchpriorityfor the LCP image: make.wordpress.org(external site: make.wordpress.org) - web.dev, Optimize Cumulative Layout Shift —
widthandheight, reserve space withmin-heightoraspect-ratio: web.dev(external site: web.dev) - Chrome for Developers, Properly size images — since Lighthouse 13 part of “Improve image delivery”: developer.chrome.com(external site: developer.chrome.com)
- Own practice — automatic processing on upload, the ten largest images first.