Skip to content

How to Optimize Images in WordPress: 8 Methods I Use on Every Site (2026)

The image optimization workflow I run on every WordPress site: WebP and AVIF, the right compression plugin, correct dimensions, lazy loading, and a CDN.

Sunny Kumar
Sunny Kumar6 min read
TL;DR

To optimize images in WordPress, serve modern formats (WebP or AVIF), compress every upload with a plugin like ShortPixel or EWWW, set images to the size they actually display, lazy-load everything except the hero, and deliver from a CDN. Format is the biggest single win: WebP is about 30% smaller than JPEG and AVIF about 50%, at the same visible quality. Then test with PageSpeed Insights.

On most WordPress sites I audit, images are the single heaviest thing on the page. Often more weight than the code, fonts and scripts combined.

That makes them the biggest speed win you have, and the easiest one to get wrong.

The good news: you do not need to be a developer. A sensible format, one good plugin, and a couple of settings get you most of the way.

Here is the exact workflow I run on every site, in the order that matters. Start at the top, because the first step moves the needle more than the rest put together.

Why image optimization matters

Your main image is usually your Largest Contentful Paint element, one of Google's Core Web Vitals. If it loads slowly, your LCP score suffers, your page-experience signals dip, and real visitors stare at a blank space.

Heavy images also burn mobile data and bandwidth. Optimizing them makes the page faster for everyone and cheaper to serve.

It is rare to find a change this simple with this much payoff.

1. Serve modern formats (the biggest single win)

If you do one thing, do this. The format you save in matters more than any other setting.

Bar chart comparing image file sizes: JPEG at 100%, WebP about 30% smaller, AVIF about 50% smaller
Same image, same visible quality. WebP and AVIF are dramatically smaller than the JPEG most sites still serve.

WebP is about 25 to 34% smaller than JPEG, and AVIF is around 50% smaller, with no quality you can see. You do not convert files by hand: an optimization plugin (next step) generates WebP or AVIF versions and serves them to browsers that support them, falling back to JPEG for the rest.

Switching your images from JPEG to WebP or AVIF moves your LCP more than anything else on this list. Everything below is refinement on top of it.

2. Compress every upload with a plugin

A plugin compresses each image on upload and bulk-optimizes your whole existing library in one run. It is the engine of the whole workflow. These three are the ones worth using.

Comparison table of ShortPixel, EWWW Image Optimizer and Smush showing active installs, free tier and WebP/AVIF support
The three I trust. Pick by the free tier: ShortPixel for modern formats, EWWW for big libraries, Smush for set-and-forget.
  • ShortPixel (300,000+ installs) is my default. It does WebP and AVIF on the free tier (100 images a month), which the others lock behind paid plans.
  • EWWW Image Optimizer (1 million+ installs) optimizes locally and unlimited for free, with no monthly cap. Best when you have thousands of images.
  • Smush (1 million+ installs) is the simplest, but it skips files over 5 MB on the free plan and keeps WebP and AVIF for Pro.

Install one, run a bulk optimize on your existing media, and let it handle every future upload.

Set it once and every image from here on optimizes itself. That is the heavy lifting done.

3. Resize and pre-compress before uploading

Plugins are not an excuse to upload a 6,000-pixel, 8 MB phone photo. Resize it first to the largest size it will ever display, usually no wider than 1,600 to 2,000 pixels for a full-width image.

The free tool I use is Squoosh, Google's in-browser compressor. Drop an image in, pick WebP, slide the quality to about 80%, and download. It shows the before and after size live, so you see exactly what you are saving. Doing this before upload keeps your media library lean.

4. Set images to the size they actually display

Serving a 2,000-pixel image into a 600-pixel slot wastes most of the bytes. WordPress helps here automatically: it generates several sizes and uses srcset so the browser picks the right one for each screen.

Your job is to not fight it. Insert images at sensible sizes, do not force a thumbnail to display huge, and make sure your theme's content width matches the image sizes WordPress creates.

5. Lazy-load everything except the hero

Lazy loading defers off-screen images until the visitor scrolls near them, so the page loads faster up front. WordPress adds loading="lazy" automatically.

But here is the mistake I see constantly: never lazy-load your hero image. The above-the-fold image is your LCP element, so it must load immediately. Lazy-loading it tells the browser to wait, which wrecks the very score you are trying to improve. Keep the hero eager, lazy-load the rest.

6. Serve images from a CDN

A CDN delivers your images from a server near each visitor instead of your single origin, which cuts load time and takes the strain off your host. Most of the optimization plugins above include CDN delivery, or you can run a dedicated one.

I go deeper on the options in my guide to the best image CDN providers, but the short version is this.

Pair a CDN with WebP or AVIF and your images stop costing you performance at all.

7. Replace animated GIFs with video

An animated GIF is enormous, often several megabytes for a few seconds.

Convert it to an MP4 or WebM and you cut the file size by around 95% for the same motion.

If you have GIFs in your content, re-host them as <video> with autoplay muted loop playsinline. It looks identical and weighs a fraction.

8. Add descriptive alt text

Not a speed tip, but part of doing images right. Alt text helps screen-reader users, gives you a shot at image search traffic, and is the accessibility basic every image needs. Describe what the image shows, plainly, no keyword stuffing.

Which plugin should you actually use?

If you want one answer: ShortPixel for most sites, because it gives you WebP and AVIF free and is simple to run. Switch to EWWW if you have a large library and do not want a monthly image cap. Reach for Smush only if you want the most hands-off basic setup and do not mind paying for modern formats.

You only need one. Running two compression plugins at once causes conflicts, so pick a single one.

How to test your image optimization

Do not guess, measure. Run your key pages through PageSpeed Insights. Look at two things:

  1. Largest Contentful Paint: aim under 2.5 seconds. If it is slow, your hero image is usually the culprit.
  2. The "Properly size images", "Serve images in next-gen formats" and "Efficiently encode images" opportunities. Each one tells you exactly which images to fix.

Site speed is an engineering problem, and images are the first place I look. Fix the format and the hero, and most sites jump from a failing LCP to a passing one in an afternoon. Images are only the first lever, though; the full order I work in is in my guide to speeding up WordPress.

Images dragging your Core Web Vitals down?

Slow images are the most common reason a WordPress site fails its speed scores, and the most fixable. If your LCP is in the red, I can sort the formats, the CDN and the loading so your pages pass.

See technical SEO

Final take

Image optimization in WordPress comes down to a short, ordered list: serve WebP or AVIF, compress every upload with one good plugin, size images to how they display, lazy-load everything but the hero, and put it all behind a CDN.

Format is the biggest win, the hero is the biggest trap, and a single plugin does most of the work. Get those right, test in PageSpeed Insights, and your images stop being the heaviest thing on the page.

Common questions

What is the best image optimization plugin for WordPress?

For most sites, ShortPixel: it converts to WebP and AVIF on the free tier and is simple to run. EWWW is better if you have a huge library and want unlimited local optimization with no monthly cap. Smush is the easy, set-and-forget choice, though WebP and AVIF need its Pro version.

How do I convert images to WebP in WordPress?

Use an optimization plugin. ShortPixel, EWWW and others generate WebP (and AVIF) versions of your images automatically and serve them to browsers that support them, falling back to JPEG for the rest. You do not convert each file by hand, the plugin handles it on upload and in bulk for old images.

Does image optimization help SEO?

Yes, indirectly. Smaller images load faster, which improves Largest Contentful Paint, a Core Web Vital that feeds Google's page experience signals. Faster pages also keep visitors longer. Add descriptive alt text and you help image search and accessibility on top of the speed gain.

How do I optimize images without losing quality?

Use modern formats and sensible compression. WebP and AVIF cut file size 30 to 50% with no visible quality loss. Keep compression around 75 to 85% quality, which the eye cannot tell from the original, and always resize the image to the dimensions it actually displays at before compressing.

Should I compress images before uploading or use a plugin?

Both, ideally. Resize and pre-compress large photos with a free tool like Squoosh before upload so you are not storing 5 MB originals, then let a plugin handle format conversion and bulk optimization. At minimum, run a plugin so every image is optimized automatically.

Why is my hero image hurting my page speed score?

Usually because it is lazy-loaded or uncompressed. The main above-the-fold image is your LCP element, so it must load immediately, never lazy-loaded, and be served compressed in WebP or AVIF at the right size. Lazy-loading the hero is the most common image mistake I see.

Written by
Sunny Kumar
Sunny KumarSEO Specialist & product builder

SEO Specialist and product builder with 10+ years in search. The notes come from the work, not the theory.

Work with TheGuideX

Reading about it is the easy part.

Send us the site and the problem. Your first reply comes from Sunny Kumar — not a sales team — and tells you if it is a fit.