When someone says a website is slow, images are usually the cause. A photo taken on a phone was uploaded as it was, a PNG from a designer was used without conversion, or several large pictures were added to WordPress. None of this is careless on purpose, but together it produces a page that makes people wait several seconds.
This article explains image optimization in the order you would actually do it: choosing a format, exporting at the display size, setting width, height and srcset, where loading="lazy" helps and where it hurts, practical WordPress settings, and alt text (the description read aloud in place of an image). It aims to answer "what do I do tomorrow, and in what order", not only to rank formats. Continuous monitoring is covered in Core Web Vitals monitoring tools compared, and faster delivery in CDN choices for small businesses. This article stays with the image files themselves.
Main sources for this article: web.dev on LCP, CLS, lazy loading and Fetch Priority; MDN Web Docs on image types, responsive images and the <img> element; Google's pages on WebP and image SEO; WordPress core development posts (5.3, 6.3, 6.5, 6.7); the W3C WAI alt decision tree and WCAG 2.2; and the HTTP Archive Web Almanac 2025. All were checked on 24 November 2026.
| What you will learn | Short answer |
|---|---|
| Which image to fix first | The LCP image. Measure first (chapters 1 and 2) |
| Which format to choose | WebP for photos, AVIF as an addition, SVG for logos (chapter 3) |
| What size to export | Up to twice the display width (chapter 4) |
| How to write the HTML | width, height, srcset, sizes, picture (chapter 5) |
| Where lazy is safe | Only outside the first screen, never on the LCP image (chapter 6) |
| WordPress in practice | What is automatic and what is up to you (chapter 7) |
| How to write alt | By role of the image; empty for decoration (chapter 8) |
| Pitfalls, order and checklist | Symptom table, sequence, checklist (chapters 9 to 13) |
1. Measure first: which image is heavy, and which one matters most
Image optimization is not a job of treating every image the same. The heaviest image and the image that decides perceived speed are not always the same one. Answer two questions before you start.
Three numbers to look at
You need three things: how many bytes the images add up to on the page, which image is the LCP image (the largest element on first load), and whether any images lack width and height.
The first comes from the network panel of your browser's developer tools, filtered to images and sorted by transferred size. The second comes from the LCP element shown in PageSpeed Insights. web.dev describes LCP as the render time of the largest image, text block or video visible in the viewport, with 2.5 seconds or less as good and more than 4.0 seconds as poor, at the 75th percentile. The third shows up in the diagnostics of the same report.
| What to check | Where to look | What it tells you |
|---|---|---|
| Total image weight, largest first | Network panel in developer tools | Which images are heavy |
| The LCP element | PageSpeed Insights diagnostics | Which image sets perceived speed |
| Images without width and height | PageSpeed Insights diagnostics | Cause of layout jumps after load |
| Rendered size | Select the image in developer tools | Whether the source file is oversized |
The table lists where to check. With the numbers side by side, the work shrinks to something like "only three images were heavy" or "only the LCP image was the problem".
The LCP element is often an image
LCP can be an <img>, a video poster, a background image set with url(), or a block of text. In the Web Almanac 2025 (measured July 2025), the LCP element was an image on 76.0% of mobile pages and 85.3% of desktop pages. On most pages, the most important element is an image.
When the LCP image is a CSS background-image, its address is not in the HTML, so the browser finds it late. web.dev recommends that the LCP image be discoverable in the HTML, through src or srcset on an <img>. If your home page photo is a background for design reasons, start there.
2. Four ways images slow a page down
Images are not slow only because files are large. web.dev splits LCP into four parts with target shares, and an image problem always shows up in one of them.
Splitting LCP into four parts
The four parts are: waiting for the server's first response (TTFB), the delay before the image starts loading, the time to download the image, and the delay before it is painted. web.dev gives rough shares: about 40% for the server response, about 40% for downloading the image, and under 10% each for load delay and render delay.
web.dev says not to turn these shares into fixed millisecond budgets, and to use them to compare the parts with each other. The reading is simple: a long download means the file is too big, and a long load delay means the image is found late.
| Part | Common cause when it is long | What you can do with images |
|---|---|---|
| Server response (~40%) | Weak server or caching | Cannot be fixed with images (CDN, hosting) |
| Load delay (<10%) | Background image, injected by JS, lazy on the wrong image | Write an <img> in HTML, remove lazy |
| Download (~40%) | Large file, heavy format | Re-export, convert to WebP, offer several sizes |
| Render delay (<10%) | Other scripts and painting congestion | Reduce the number and size of images |
The table maps symptoms to actions. Image work mainly fixes "download" and "load delay", and the server part is left to other measures such as a CDN.
Images also cause layout shift
Without width and height, the layout is pushed down when an image arrives and the text you were reading jumps. That is CLS (layout shift), which web.dev rates 0.1 or less as good and above 0.25 as poor. In the Web Almanac 2025, 62% of mobile pages (65% on desktop) had at least one image without width and height. Chapter 5 fixes this at the same time as the weight.
3. Choosing a format: JPEG, PNG, WebP, AVIF, SVG
Many people get stuck on formats because the discussion is framed as "which is best". In practice you need a fixed answer for each kind of image.
The default answer by kind of image
MDN organises it like this: photos use WebP or AVIF with JPEG as a fallback; logos, icons and diagrams use SVG; screenshots, line art and images needing transparency use PNG (WebP or AVIF are better where supported); animations use WebP or AVIF rather than GIF.
| Kind of image | Default format | Fallback | Avoid |
|---|---|---|---|
| Photos (people, shop, products, scenery) | WebP | JPEG | PNG (too large) |
| Large photos (home page hero) | Add AVIF if useful | WebP and JPEG | Over-compressed JPEG |
| Logos, icons, diagrams | SVG | PNG | Turning photos into SVG |
| Screenshots, images with text | PNG or lossless WebP | PNG | Heavily compressed JPEG (text gets rough) |
| Images needing transparency | WebP or PNG | PNG | JPEG (no transparency) |
| Moving images | Video or WebP | GIF | Large GIFs |
The rule to remember is "WebP for photos, SVG for drawings". Using fewer formats on one site also makes later maintenance easier.
How much smaller is WebP
Google says lossy WebP is 25 to 34% smaller than JPEG at an equivalent quality index (SSIM), and lossless WebP is 26% smaller than PNG. The range exists because it depends on the image. It is not a promise of "half the size".
MDN notes that WebP is widely supported in current browsers, with Safari 14 or later (and macOS Big Sur or later) required. Because of older devices, keep a JPEG or PNG fallback.
AVIF is often best as an addition
AVIF compresses strongly and is royalty-free. MDN lists support from Chrome 85, Edge 121, Firefox 93 and Safari 16.1. It does not support progressive rendering, and MDN advises providing a WebP, JPEG or PNG fallback.
Actual use is still low. In the Web Almanac 2025, LCP images were JPEG about 57% (about the same on mobile), PNG 26%, WebP 11% and AVIF 0.7%.
The figure shows that moving to WebP already puts you in the minority. You are not behind if you stop short of AVIF.
When to add AVIF
| Situation | Decision | Reason |
|---|---|---|
| A few photos, rarely updated | WebP and JPEG only | The gain is small for the effort |
| One or two large photos on the home page | Add AVIF for those only | Helps where the transfer is largest |
| Hundreds of images and an automated pipeline | Output AVIF automatically | No extra effort, helps everywhere |
| The CMS cannot output a picture fallback | Skip AVIF | Breaks in environments that lack support |
| Staff export images by hand | WebP only | More formats means more mix-ups |
The table balances effort against effect. AVIF is a tool to add where it pays off, not a badge.
4. Export at the display size
Sometimes more effective than changing the format is matching the dimensions to the display size. A 4,000-pixel-wide photo shown in a 720-pixel slot sends mostly pixels that are never used.
How to decide the dimensions
First find the largest width at which the image is actually displayed; developer tools show this when you select the image. Then use up to twice the display width as a rule of thumb. On high-density screens (most phones) one CSS pixel uses several device pixels, so an exact-width image can look soft. This is a rule of thumb, not an official figure.
| Where the image sits | Example maximum display width | How to set the largest file |
|---|---|---|
| Image in an article body | About 720px | About 1440px, twice that |
| Full-width home page photo | About 1200 to 1440px | Twice is too large; decide by eye |
| Cards in a list | About 300 to 400px | About 600 to 800px |
| Small icons and avatars | About 48 to 96px | Use SVG, or twice the size |
This is an example of the thinking. For full-width photos, twice the size adds a lot of transfer, so judge by appearance. There is no single answer; compare quality and size per image.
Do not upload the original as is
Phone and camera photos can be wider than 4,000 pixels. Since 5.3, WordPress scales down an uploaded image whose width or height exceeds 2,560 pixels and uses the scaled version (the original is kept). Yet 2,560 pixels is still far too big for a 720-pixel column. Do not rely on that automatic scaling: export to the size you need before uploading.
Decide file size by eye
The right compression level depends on the picture. Faces, thin text and smooth skies show damage; busy landscapes hide it. Rather than fixing one quality number, export two or three levels and compare them at the real display size. A simple policy by role works well: do not over-compress the home page hero, and compress supporting photos in articles harder.
5. Writing it in HTML: width, height, srcset, sizes, picture
Once size and format are set, decide how to write them in HTML. Writing it wrongly can still make a lighter image load at the wrong size or cause layout shift.
Put width and height on every image
web.dev says to always include width and height on images and video. According to MDN they are the intrinsic size in pixels (unitless integers), so the browser can compute the aspect ratio and reserve space before the image arrives.
<img src="photo-720.webp" width="720" height="480" alt="…">
CSS such as max-width: 100%; height: auto; can still change how it looks while the ratio is kept. web.dev explains that width: 100% with height: auto keeps the reserved ratio. If you cannot set the attributes, CSS aspect-ratio also reserves the space.
srcset and sizes: let the browser pick one file
srcset lists candidate files, each with its real width using a w descriptor (not px). sizes tells the browser how wide the image will be shown, under conditions. The browser reads the display width from sizes and picks the closest file from srcset.
<img
src="photo-1440.webp"
srcset="photo-720.webp 720w, photo-1440.webp 1440w"
sizes="(min-width: 800px) 720px, 100vw"
width="1440" height="960"
alt="…">
Conditions in sizes are evaluated in order and the first match is used; the last entry has no condition. MDN says a percentage cannot be used in sizes, only a length such as 50vw. Without sizes, the browser assumes the image fills the screen width (100vw) and fetches more than needed.
picture: offering fallbacks by format
To offer WebP and AVIF, use <picture>. As in MDN's example, put <source> elements in order of preference and finish with an <img>. The browser picks the first format it supports.
<picture>
<source type="image/avif" srcset="photo.avif" />
<source type="image/webp" srcset="photo.webp" />
<img src="photo.jpg" width="1440" height="960" alt="…" />
</picture>
With <picture>, put width, height, alt, loading and fetchpriority on the final <img>. If you also vary sizes, give each <source> its own srcset and sizes. MDN says to use media conditions only for art direction (different crops), and not to mix them with sizes.
| Attribute | Where | Role | If you forget it |
|---|---|---|---|
width, height |
Every <img> |
Reserve space, aspect ratio | Layout jumps after load |
srcset (w) |
<img> with several sizes |
Lists candidate files | One large file goes to everyone |
sizes |
With srcset |
Tells the display width | 100vw is assumed |
<picture> and type |
When offering formats | Format fallback | Fails on unsupported browsers |
alt |
Every <img> |
Text in place of the image | File name may be read aloud |
The table lists each attribute's job. All of them give the browser correct information sooner, and while they cost little to write, leaving them out is expensive to fix later.
6. loading="lazy" and fetchpriority: where to use and where to avoid
Two attributes control how images load, loading and fetchpriority, and their goals are opposite: one pushes less urgent images later, the other pulls an urgent image earlier.
How loading="lazy" works
With loading="lazy", an image loads when it gets near the viewport. web.dev explains that Chrome starts loading at a fixed distance from the screen, which a July 2020 change set to 1,250 pixels on 4G. The distance is set by the browser and the page cannot change it. It works in Chrome 77, Edge 79, Firefox 75 and Safari 15.4 or later.
MDN lists cautions: set width and height (an unloaded image is treated as 0 by 0), deferral does not happen when JavaScript is off, and it does not apply to CSS background images. web.dev adds that an image hidden with display: none is not loaded, while one hidden with opacity: 0 is.
Where to use it and where to avoid it
web.dev advises against loading="lazy" on images in the first screen, especially the LCP image. The reason is that a lazy image only starts loading after the browser knows the layout, so the "load delay" part of LCP grows.
| Where the image is | lazy | fetchpriority | Reason |
|---|---|---|---|
| Large first photo of a home page or article (LCP image) | No | high (one image) | Painted first, so do not delay |
| Logo in the header | No | No | In the first screen and small |
| Second and later images visible at first | No | No | Visible immediately |
| Images further down the article | Yes | No | Not visible yet |
| Images in the footer | Yes | No | Not visible yet |
| Slides 2 and later in a hidden carousel | Yes | low is also fine | Can wait until shown |
| CSS background images | Not applicable | Not applicable | Attributes belong to <img> |
The table splits images by whether they are visible when the browser first paints. If unsure, ask whether it is visible in the first screen. Keep in mind that the first screen differs between phone and desktop.
In the Web Almanac 2025, 17% of mobile pages lazy-loaded their LCP image (about 10% with loading="lazy" and about 6% with a data-src approach). It is often added without anyone noticing.
fetchpriority="high": for one urgent image
fetchpriority is a hint about fetch priority. web.dev explains that fetchpriority="high" on the LCP image lets the download start at high priority without waiting for layout. In a Google Flights test, setting it on the hero image cut LCP from 2.6 seconds to 1.9 seconds. It works in Chrome 102, Edge 102, Firefox 132 and Safari 17.2 or later.
Use it on one or two images at most. web.dev says that setting it on many images makes it unhelpful: priority is relative, so if everything is "high", nothing is. fetchpriority also does not help the browser find an image. For late-discovered images, such as CSS backgrounds, combine it with <link rel="preload">.
In the Web Almanac 2025, 17.3% of mobile LCP images had fetchpriority="high". Many sites still have room to gain just by adding it.
Make the LCP image discoverable in HTML
web.dev recommends that the LCP image (1) has src or srcset in the HTML (not injected by JavaScript, hidden in data-src or set as a background), (2) is not lazy-loaded, (3) has fetchpriority="high", and (4) is served from the same origin as the HTML, since another host adds connection cost.
<img src="hero-1440.webp" width="1440" height="810"
fetchpriority="high" alt="…">
That single line is the ideal first-screen image. Note that there is no loading attribute (the default is eager): for the LCP image, add nothing but the priority.
7. WordPress in practice: what is automatic and what you do
WordPress adds many loading attributes for you, so knowing what it does and what it does not do is the starting point for image work there.
What WordPress does automatically
According to the WordPress core development posts:
| Version | What happens automatically | Note |
|---|---|---|
| 5.3 | Images over 2,560px in width or height are scaled down for use | The original is kept; a filter can change or disable it |
| 6.3 | fetchpriority="high" on the large image likely to be LCP |
Images larger than 50,000 pixels in area |
| 6.3 | The first few images get no loading="lazy" |
The default number skipped went from 1 to 3 |
| 6.7 | sizes="auto" added for lazy-loaded images |
Only on images with loading="lazy" |
The table sums up the automatic behaviour. The 6.3 post also says fetchpriority="high" and loading="lazy" are never added to the same image and that attributes you set yourself are not overridden. It describes a typical LCP improvement of 5 to 10%.
sizes="auto" lets the browser use the image's real layout width when choosing from srcset on lazy-loaded images. MDN says auto is valid only with loading="lazy". The WordPress post explains that this reduces cases where an oversized file is downloaded.
Format conversion is your job
WordPress 6.5 added AVIF uploads and use. The post states that it depends on the server image library (Imagick or GD) and that uploaded JPEGs are not converted to AVIF automatically. You can check support under Tools, Site Health, Info, Media Handling, and see whether AVIF appears in the supported formats.
To convert on upload, the image_editor_output_format filter is available. The original is kept and the generated sizes become AVIF. The post also says that if many visitors use browsers without AVIF, you should avoid AVIF or add a fallback.
The Performance Lab plugin
The WordPress performance team offers Performance Lab so that features likely to reach core can be tried early. On 24 November 2026 its plugin page listed feature plugins such as Modern Image Formats, Image Prioritizer and Enhanced Responsive Images. The changelog for Modern Image Formats says it generates only WebP images by default for JPEG and WebP uploads.
Two cautions. The page's FAQ describes the plugin as close to a beta-testing plugin and says using it on a production site carries risk. It also requires WordPress 6.9 or higher. Test it in a staging environment and check how pages render before putting it on the live site.
Existing images, themes and page builders
It is not only new uploads. Large images already in the media library need attention too. Sort the library by size, re-export the biggest ones and replace them. Conversion and resizing plugins may need a separate bulk regeneration step for existing images.
Also check whether your theme or page builder outputs photos as backgrounds. As chapter 6 explained, background images are found late and lazy loading does not apply. In the theme settings, see whether the large home page photo can be an image block rather than a background. For the workflow before export, see what humans should check when automating image production.
8. Writing alt text: the sentence read in place of an image
Alt text looks like a side topic in an article about weight, but it is the part of image work most often overlooked. People using screen readers, people whose images fail to load, and search engines all use it to learn what an image is.
The basic rule: write by role
The W3C Web Accessibility Initiative publishes an alt decision tree. The idea is to decide the role of the image in the page first.
| Role of the image | How to write alt | Example |
|---|---|---|
| Photo or figure that conveys content | Briefly state what it conveys | "Shop entrance with a wooden door and chalkboard sign" |
| Image in a link or button | Destination or action | "See the list of price plans" |
| Logo | Company name (and destination if linked) | "DevNJ home" |
| Complex chart or diagram | Short point; details in text or a table | "Monthly visits trend; details in the table below" |
| Image of text | The same text | Same sentence as in the image |
| Decoration or divider | Empty (alt="") | alt="" |
The table applies the W3C tree to images common on small business sites. The example wording is illustrative. The same photo can need a different alt on a different page.
Leave decoration empty
MDN explains that alt="" marks an image as decorative or not a key part of the content. If you omit alt, some screen readers read out the file name, which is confusing for names like IMG_2041.jpg. Marking an image decorative with an empty alt is more correct than forgetting it.
MDN also advises against alt text such as "image". Write what the image conveys, not the image itself.
Search and legal angles
Google asks for useful, information-rich alt text that fits the page context, and says keyword stuffing is treated as spam and hurts the experience. Its example is a description such as a Dalmatian puppy playing fetch. It also advises short, descriptive file names.
WCAG 2.2 success criterion 1.1.1, Non-text Content (Level A), requires a text alternative that serves the equivalent purpose, with decoration implemented so assistive technology can ignore it. For how this connects to the European Accessibility Act when you serve European visitors, see website redesign and the European Accessibility Act, and for automated checks see accessibility checker tools compared.
Background images cannot have alt
CSS background images cannot carry alt text, and Google says it does not index CSS images. Images that convey content or that you want found in search should be written as <img>, which is right for alt text too.
9. Common pitfalls: from symptom to cause
Even in the right order, optimization can trip over unexpected things. Here are common symptoms with causes and fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
| LCP did not change after WebP | The LCP image is a background and is found late | Use an <img> and add fetchpriority="high" |
| Looks soft on phones after shrinking | Exported too small for the display width | Offer up to twice the width with srcset |
| Images appear late while scrolling | Images just before the screen are lazy too | Remove lazy from first-screen images |
| Text moves after load | No width and height |
Add the attributes, or aspect-ratio |
| Some environments show no image | No final <img> in <picture> |
Always add a fallback JPEG <img> |
| Transparent image gets a white fill | Saved as JPEG | Use PNG or WebP |
| Slide 2 of a carousel is slow | Hidden images set to lazy | Load just before they are shown |
| WordPress conversion does nothing | Server lacks AVIF support | Check Site Health and use WebP |
The table is ordered by how often these occur. Most symptoms come down to "the LCP image is being delayed" or "size information is not passed on".
Check with numbers
After a fix, measure again the same way. PageSpeed Insights varies from run to run, so take several runs and compare medians. Field data from real users is aggregated over the last 28 days, so improvements take weeks to show. For ongoing checks, see Core Web Vitals monitoring tools compared.
10. The order of work: biggest effect first
Here is everything above reordered by effect and effort. Do not try everything at once; go from the top, which is how it lasts.
| Order | What to do | Where it helps | Effort |
|---|---|---|---|
| 1 | Find the LCP image; if it is a background, make it an <img> |
Load delay | Small |
| 2 | Remove lazy from it and add fetchpriority="high" |
Load delay | Small |
| 3 | Re-export the LCP image at display size | Download | Small |
| 4 | Re-export and convert the largest images (the top ten or so) to WebP | Download | Medium |
| 5 | Add width and height to all images |
CLS | Medium |
| 6 | Add loading="lazy" to images off-screen |
Initial transfer | Small (automatic in WordPress) |
| 7 | Offer several sizes with srcset and sizes |
Download | Medium to large |
| 8 | Review alt text by role | Accessibility, search | Medium |
| 9 | Write down the rules (export before upload) | Preventing relapse | Small |
This also means the top three often suffice. Steps 1 to 3 can be done in a day and have the largest effect, so make them the first goal.
Procedure: fix one LCP image
- Open the mobile result for the home page in PageSpeed Insights and note the LCP element.
- Check in developer tools whether it is an
<img>or a background. - Find the largest display width and export at up to twice that.
- Save as WebP (with JPEG as fallback).
- Write
widthandheight, leave outloading, and addfetchpriority="high". - Before publishing, view it at phone width for jumps and softness.
- Measure the same page again and compare the LCP element and value with the earlier run.
After these seven steps, the LCP image is easy to find, light, and fetched first.
11. By situation: where to start
Sites differ in the state of their images. The table gives where to look first for common situations. These are rules of thumb, not examples of specific companies.
| Situation | Look first at | Reason |
|---|---|---|
| Shop or salon site with many photos | The hero photo and gallery count | Affects both the LCP image and initial transfer |
| A blog run for years | Huge old images and featured images | Old oversized originals tend to remain |
| A new corporate site | Set the export rules first | Cheaper than fixing everything later |
| A site built with a page builder | Whether the home page photo is a background | Load delay grows easily |
| Online shop with many product images | List thumbnail sizes and lazy | Lists have many images and large transfer |
| A multilingual site | Duplicate copies of images per language | Weight grows through duplicates |
The table enters by type of site rather than by symptom. In every case, start by checking the LCP image, then move to the place that fits the situation.
12. What not to do
Optimization often fails by creating a different problem. These are the things to avoid, with reasons.
| Do not | Reason |
|---|---|
Put loading="lazy" on every image |
The LCP image is delayed and the page gets slower |
Put fetchpriority="high" on every image |
Priority loses its meaning |
| Compress too hard | Hurts the impression of products and shop and can cost enquiries |
| Offer only AVIF without a fallback | Fails where AVIF is unsupported |
| Shrink dimensions with CSS alone | The large file is still downloaded |
Omit width and height |
The layout jumps after load |
| Stuff alt with search keywords | Treated as spam and worse to listen to |
| Give decorative images long alt text | Gets in the way of screen readers |
| Put text into images | It cannot be read aloud and is less likely to be found |
| Add a conversion plugin to production untested | Can break layouts or lose images |
The top two are typical cases where good intentions backfire. "Add it to everything" is best avoided for almost every attribute here.
13. Checklist
Use this before publishing and during reviews.
Measure
- I identified the LCP element in PageSpeed Insights
- I sorted images by transfer size and checked the largest
Prepare images
- I exported at up to twice the display width
- Photos are WebP (with JPEG fallback), logos and diagrams are SVG
- I checked appearance and did not over-compress
Write the HTML
- Every
<img>haswidthandheight - The LCP image is an
<img>withoutloading="lazy" - I put
fetchpriority="high"on one image only - Images outside the first screen have
loading="lazy" - Every
<picture>ends with a fallback<img>
Alt text
- Content images have alt that matches their role
- Decorative images use
alt="" - No keyword stuffing in alt
WordPress
- I checked supported image formats in Site Health
- I reviewed large images in the media library
- I tested plugins in staging before production
14. Keeping it up: monitoring and delivery are separate jobs
Even after you tidy images, new ones pile up and the numbers can slip back within months. Setting working rules first lasts longer than a one-off clean-up.
Three rules help: export images to the display size and format before upload; check loading and fetchpriority on any image that becomes the LCP image before publishing; and measure regularly, such as monthly, and review when thresholds are crossed. Watching the numbers is covered in detail in Core Web Vitals monitoring.
Delivering images from nearer servers is a separate layer from making them smaller. Choosing a CDN covers it from the angle of cost and data handling. Make images small first, then put them on a CDN, and the effects add up.
15. Summary
- Start image optimization by identifying the one LCP image.
- For formats: WebP for photos with JPEG as fallback, SVG for logos and diagrams, and AVIF added for large photos.
- Export at up to twice the display width, and decide quality by looking.
- Put
widthandheighton every image, and usesrcsetandsizesto offer sizes. - Use
loading="lazy"only off-screen. Keep it off the LCP image and give that one imagefetchpriority="high". - WordPress automates a lot, but format conversion and source-file control are still yours.
- Write alt text by role and leave decorative images empty.
Image work is not one big change but a short run of fixes in the places that matter most. If you would like to think through where to start on your own site, which WordPress settings to change, or how to set image rules for your team, see DevNJ's services and get in touch through the contact page. We will ask about your current site before suggesting how to proceed.
Sources
Metrics and loading (web.dev)
- Largest Contentful Paint (LCP) — web.dev: LCP elements and thresholds
- Optimize Largest Contentful Paint — web.dev: the four parts and LCP image handling
- Optimize Cumulative Layout Shift — web.dev: width, height and shift thresholds
- Browser-level image lazy-loading for the web — web.dev: how lazy loading works and its limits
- Optimize resource loading with the Fetch Priority API — web.dev: using fetchpriority and a measured example
HTML and image formats (MDN, Google)
- Image file type and format guide — MDN: format features and browser support
- Responsive images — MDN: srcset, sizes and picture
- The Image Embed element — MDN: alt, loading, fetchpriority and sizes="auto"
- WebP — Google for Developers: size comparison with JPEG and PNG
- Google Images best practices — Google Search Central: alt, file names, supported formats, CSS images
WordPress
- Introducing handling of big images in WordPress 5.3 — Make WordPress Core: the 2,560px threshold
- Image performance enhancements in WordPress 6.3 — Make WordPress Core: automatic fetchpriority and lazy decisions
- WordPress 6.5 adds AVIF support — Make WordPress Core: AVIF requirements and conversion
- Auto Sizes for Lazy-Loaded Images in WordPress 6.7 — Make WordPress Core: sizes="auto"
- Performance Lab — WordPress.org: feature plugins and cautions
Accessibility (W3C)
- An alt Decision Tree — W3C WAI: alt by role
- Understanding SC 1.1.1: Non-text Content — W3C WAI: the non-text content criterion
Statistics
- Performance — Web Almanac 2025: LCP image formats, lazy loading, fetchpriority and unsized images
All were checked on 24 November 2026. Browser support, WordPress features and plugin contents change, so check the official pages before you implement anything. The export sizes given are rules of thumb and vary with how your site is built.
FAQ
- Where should I start when making my website images lighter?
- Identify the one image that is displayed largest on first load (the LCP image) and re-export only that image at its display size. Then convert to WebP, add width and height, and add loading=lazy to images below the fold. This order avoids rework and gives the biggest gain first.
- Should I use WebP or AVIF?
- For a small business site, WebP with a JPEG fallback is enough to start. Google says lossy WebP is 25 to 34% smaller than JPEG at equivalent quality. AVIF compresses harder but adds export and maintenance work, so adding it only for a few large photos, such as a home page hero, is a realistic use.
- Can I put loading=lazy on every image?
- No. Images visible in the first screen, especially the LCP image, should not be lazy-loaded, because it delays the start of the download and slows the page. web.dev advises against lazy-loading the LCP image. Use lazy for the second and later images that start below the visible area.
- Do I need width and height on images?
- Yes. They let the browser reserve space before the image arrives, which prevents the layout shift (CLS) that pushes text down once images load. CSS can still resize the image while the aspect ratio is kept. In WordPress, check the rendered HTML, because themes and injected markup can drop them.
- How do I get WebP or AVIF in WordPress?
- WordPress 6.5 added AVIF uploads, but JPEG files are not converted automatically. To output WebP or AVIF you can use a core filter, the official Performance Lab family of plugins, or convert files before upload. The server image library (Imagick or GD) must support the format, which Site Health shows.
- What should I write in alt text?
- Describe what the image conveys in the context of the page, briefly. Use an empty alt (alt="") for purely decorative images. W3C advises that images inside links or buttons describe the destination or action. Stuffing search keywords is treated as spam by Google and hurts the experience.
Planning a site that has to work in both markets?
Get in touch