How to compress images for WordPress

WordPress will happily accept a 6 MB photo straight from your phone, resize it into six thumbnails, and serve it to every visitor. It will also make your pages crawl. The fix is not a plugin installed on top of a messy media library — it is getting the file right before you upload it.

Start with pixels, not kilobytes

WordPress itself creates the sizes it needs — thumbnail, medium, large and whatever your theme registers. What it cannot do is repair an image that is far too big to begin with, because every one of those generated copies inherits the problem.

So decide the largest size the image will actually be shown at, and upload that:

Then choose a format and a quality

For photographs, WebP is the sensible default: the same visual quality lands in a substantially smaller file than JPEG, and every browser WordPress has to support on current versions can display it. Keep JPEG for anything that must stay compatible with older external tools, and PNG only when you need transparency or perfectly crisp flat colour — a screenshot of text, for example.

Aim for a final file of roughly 100–250 KB for a photo that fills the content column. If you are far above that, the problem is almost always resolution rather than quality: dropping the quality slider to 40 gets you a blurry mess, while resizing to the right pixel width gets you the same smaller file with no visible damage.

The order that works

  1. Work from the original camera or design file.
  2. Resize to the largest size the image will be displayed at.
  3. Compress the smaller image, keeping the quality around 70–80 for photos.
  4. Convert to WebP if the rest of your site is served in WebP too.
  5. Check the result on a phone before you upload it.

If you have a folder of images ready to go, the batch tool applies the same settings to all of them and hands back a ZIP, which saves a lot of clicking.

Before you upload: two things that catch people out

Filename. Rename IMG_4821.jpg to something descriptive such as walnut-desk-organiser-side-view.jpg before uploading. WordPress derives the attachment slug from the filename, and descriptive names are one of the few image SEO details you fully control.

Alt text. Alt text is what a screen reader announces and what shows when an image fails to load. Describe the image rather than stuffing in keywords: "walnut desk organiser with two pen cups" beats "desk organiser, pen holder, gift".

If images are still slow after all this

Compression is only half of it. Modern browsers pick a file based on the width attribute of your theme and the reported device width, so the markup matters too. If you are debugging with a page speed tool and the report points at images, compare the reported file size against the dimensions it says are being downloaded: if a 300-pixel thumbnail is being served as a 1600-pixel file, the media library has the wrong version, and re-uploading a correctly sized file is faster than installing another plugin.

Frequently asked questions

What is a good image file size for WordPress?

Around 100–250 KB for a photograph in the content column, and up to about 300–400 KB for a full-width hero. Anything above that is worth investigating, unless it is a deliberately detailed illustration or a print-quality download.

Does WordPress compress images automatically?

It generates several resized copies of each upload and applies a moderate JPEG quality setting, but it does not turn a 6000-pixel camera file into a sensibly sized one. Uploading an image that is already the right size gives a better result.

Should I upload WebP or JPEG to WordPress?

WebP is safe on current WordPress versions and gives smaller files for the same visible quality. The one caution is external systems — email clients, print services or plugins that expect a JPEG. When in doubt for a photo, JPEG is never a wrong answer.

Will compressing hurt my image SEO?

No. Search engines weigh page experience heavily, and a smaller image that displays at the correct size is better for SEO than a large one. Image search also prefers files that load quickly.

Can I compress images that are already in my media library?

Yes, but replacing a file in place is awkward: download the image you want to shrink, compress it, then upload it as a new attachment and update the page. Alternatively, regenerate your thumbnails after the swap.