How to Optimize Images in WordPress: Resize, Compress, WebP and AVIF

Make WordPress images load faster: resize to the right width, compress, switch to WebP or AVIF, keep the hero image from lazy loading, and write good alt text.

How to Optimize Images in WordPress: Resize, Compress, WebP and AVIF

Quick answer: Resize images to the width they are actually shown at (usually 1200–1600 px for content), compress them, and use WebP or AVIF instead of large JPEG or PNG files. WordPress supports WebP uploads since version 5.8 and AVIF since 6.5, creates smaller sizes automatically, and lazy-loads images below the fold. Keep your main (hero) image from being lazy-loaded.

Images are often the heaviest part of a WordPress page. A single photo straight from a phone can be 4–6 MB, more than everything else on the page combined. Optimising images is usually the quickest way to improve load time and your Largest Contentful Paint (LCP) score. This guide covers what WordPress already does for you and what you need to do yourself.

What WordPress already does automatically

Feature Since What it does
Multiple image sizes and srcset 4.4 Creates thumbnail, medium, large and other sizes, and lets the browser pick the smallest suitable one
Big image threshold 5.3 Scales uploads larger than 2560 px down and keeps that as the main image
Native lazy loading 5.5 Adds loading="lazy" so off-screen images load only when needed
WebP uploads 5.8 Accepts WebP files in the Media Library
fetchpriority="high" 6.3 Tells the browser to load the likely LCP image first
AVIF uploads 6.5 Accepts AVIF files, if your server’s image library supports them

So the main jobs left for you are: upload images at a sensible size, compress them, and choose a modern format.

Step 1: Resize before you upload

Check how wide your content area is. On most blog themes it is 700–900 px, so an image 1200–1600 px wide looks sharp on high-resolution screens. Anything larger is wasted. Resize on your computer before uploading, using any image editor or a free web tool such as Squoosh.

  • Blog images: 1200–1600 px wide.
  • Full-width hero images: up to about 2000 px wide.
  • Logos and icons: use SVG where possible, or PNG/WebP at twice the displayed size.

Step 2: Pick the right format

Format Use for Notes
WebP Photos, screenshots, graphics Supported by all current browsers; usually much smaller than JPEG/PNG at similar quality
AVIF Photos Often smaller than WebP, but slower to create; your host must support it
JPEG Photos, if you can’t use WebP Use quality 75–85
PNG Screenshots with text, images needing transparency Can be large; convert to WebP where possible
SVG Logos, icons Tiny and sharp at any size; only upload SVGs you trust

To check whether your server can handle AVIF, go to Tools → Site Health → Info → Media Handling and look at the supported formats listed for your image library.

Step 3: Compress images

You can compress before uploading, or let a plugin do it on upload and convert existing images:

  • Before upload: Squoosh (browser-based) or any editor’s “export for web” option.
  • Plugins: tools such as ShortPixel, Imagify, EWWW Image Optimizer, or the image optimisation in LiteSpeed Cache on LiteSpeed servers. Most offer a free tier with limits.

Pick one image plugin only. Two plugins converting the same images can create duplicate files and conflicts.

Step 4: Don’t lazy-load the main image

Lazy loading helps images further down the page, but it slows down the first large image visitors see, which is usually what Google measures as LCP. WordPress tries to skip lazy loading for the first content images automatically. If you use a page builder or a lazy-load plugin, check that your hero or featured image is not lazy-loaded; most optimisation plugins have an option to exclude the first image or images with a specific class.

Step 5: Write useful alt text

Alt text describes the image for screen readers and for search engines. Describe what the image shows and why it is there, in a short sentence, for example “cPanel MultiPHP Manager with PHP 8.3 selected”. Leave alt text empty only for purely decorative images.

Step 6: Measure the result

Test a post in PageSpeed Insights before and after. Look at the Largest Contentful Paint value and the “Properly size images” and “Serve images in modern formats” suggestions. For other speed fixes, see our complete speed guide and lazy loading tutorial.

Frequently asked questions

Should I convert all my old images to WebP?

For sites with many images, yes. Use an optimisation plugin’s bulk tool so existing posts benefit too. Keep the originals until you have checked the site.

Does image size affect SEO?

Indirectly. Large images slow the page down, which hurts Core Web Vitals and user experience. Descriptive file names and alt text also help Google understand images.

Why are my uploads still large after compression?

Check the image dimensions. Compressing a 5000 px image still leaves a big file; resize it first, then compress.

Is AVIF better than WebP?

AVIF files are often smaller, but they take longer to generate and not every host supports them. WebP is the safer default; use AVIF if your host and plugin support it.

Sources