Black FridayCyber Monday 2026
14Days
15Hrs
12Mins
26Secs
Flat20% OFF

Our biggest sale of the year20% off the first payment on all maintenance plans. Code BF2026

Grab the deal
WordPress

Optimize Images in WordPress: WebP, AVIF, Sizes and Lazy Loading

Large images are a common reason pages feel slow. Choose the right format, size and loading behaviour, and avoid lazy loading your main image.

wpallsolution Updated 5 min read

To optimize images in WordPress, you need to get four things right: the file format, the pixel size, the width and height attributes, and when each image loads. Images are often the heaviest part of a page, so a few changes here can make a slow page feel faster without touching your design. This guide explains each choice in plain language, including the one mistake that makes things worse: lazy loading the main image at the top of the page.

Quick answer

Resize photos to roughly the largest size they display before you upload them. Use WebP or AVIF for photos where your setup supports them, keep SVG for logos and icons, and avoid huge PNG files for photographs. Make sure images have width and height so the page does not jump while loading. Lazy load images below the fold, but do not lazy load the main image visible at the top, because that delays your Largest Contentful Paint. Test on a phone before and after.

How this guide was prepared: it is research-based. We used the web.dev and WordPress sources listed under Sources, checked on October 23, 2026. We did not test your site, and savings depend on your images, theme and host.

Format: which image type for what

  • JPEG: a long-standing choice for photographs.
  • PNG: lossless and good for graphics needing transparency, but often large for photos.
  • WebP and AVIF: modern formats that usually make smaller files at similar quality; WordPress core can upload and process both on supported servers.
  • SVG: vector format for logos and simple icons that must stay sharp at any size.

Support depends on your server’s image library and the visitor’s browser, so check results after switching. Keep the originals.

The decision tree: are your images slowing the page?

Flowchart for optimising WordPress images: five questions about size, format, dimensions, the main image and lazy loading
Five questions find the biggest image savings.
  1. Are uploads much larger than they display? Resize them (Step 1).
  2. Are photos still large JPEG or PNG? Try WebP or AVIF (Step 2).
  3. Do images lack width and height? Add them (Step 3).
  4. Is the main image lazy loaded? Load it eagerly (Step 4).
  5. Do all images load at once? Lazy load the ones below the fold (Step 5).

5 steps to optimise your images

Step 1: Resize before you upload

A 6000-pixel photo shown in a 800-pixel column wastes bandwidth. Resize to about the largest size it will be shown, allowing a little extra for sharp screens. WordPress creates several sizes from an upload and shows the best one using srcset, but it still stores the original, so smaller uploads save space too. Check Settings, Media for the generated sizes.

Step 2: Choose a modern format

For photographs, test WebP or AVIF and compare file size and quality. Many optimisation plugins can convert and serve these formats; choose one that keeps a fallback for browsers that cannot show them and that lets you restore originals. Do not convert logos that should be SVG.

Step 3: Set width and height

If the browser does not know an image’s size, the page shifts when the image loads. WordPress normally adds width and height to images in content, but page builders, custom code and some themes can omit them. Check the HTML of your key pages. This protects your layout stability; see cumulative layout shift in WordPress.

Step 4: Do not lazy load the main image

Lazy loading delays an image until it is near the screen. That is helpful for images far down the page, but the image that is the largest element on first view should load right away. Recent WordPress versions try to avoid lazy loading the first large image, but themes and plugins can undo it. If your Largest Contentful Paint is slow, look at that image first; see LCP in WordPress.

Step 5: Lazy load the rest

Images below the fold, such as gallery pictures and footer logos, can load as the visitor scrolls. WordPress adds a loading attribute to images by default, so you may not need a plugin for this. Avoid stacking several lazy-load plugins, which can conflict.

Version and hosting differences

  • Older WordPress versions and servers may not process AVIF or WebP.
  • Caching and CDN setups can serve converted images from another place; clear caches after changes.
  • Page builders may output their own image markup, so check the real page source.

How to verify the result

  • Total image weight on key pages is lower.
  • The page does not jump while loading.
  • The main image appears quickly and is not lazy loaded.
  • Images still look sharp on a phone and a large screen.

Common mistakes

  • Uploading camera originals.
  • Lazy loading every image, including the main one.
  • Compressing so hard that images look blurry.
  • Installing several image plugins at the same time.

Frequently asked questions

Is WebP better than JPEG?

Often WebP files are smaller at similar quality, but results vary by image, so compare.

Does WordPress support AVIF?

Newer WordPress versions can handle AVIF if the server’s image library supports it. Check with your host.

Do I need an image plugin?

Not always. Resizing before upload and WordPress defaults go a long way, and a plugin helps with bulk conversion.

Should I lazy load every image?

No. Leave the main image at the top of the page to load normally.

Related guide: WordPress Image Upload Errors: HTTP Error, “Upload Failed” and Size Limits

What to do next

Pick your three heaviest pages, check their images and fix the largest ones first. If speed is a wider problem, see our WordPress maintenance page or contact us. We cannot promise a specific score.

Sources and official documentation

Keep reading

More guides

Need a hand with this?

Tell us what is happening. We reply with honest next steps.

Talk to us