How to Optimize Images for WordPress: The Complete Guide
Images are usually the heaviest files on a WordPress page, and they are the most common reason a site feels slow. WordPress does some of the work for you, but it cannot fix a 6 MB photo that was uploaded straight from a camera. This guide explains the problem, compares your options, and gives you a workflow you can follow.
Why images matter so much on WordPress sites
A typical blog post or product page contains a handful of pictures, and each one can weigh more than all of the page's text, code and styles combined. Heavy images affect your site in four ways.
- Speed and experience: large files delay the moment the page looks ready, especially on mobile connections. Slow pages lose visitors before they read a word.
- Search visibility: Google uses page experience signals such as Largest Contentful Paint, and a big hero image is often the element that decides that score.
- Hosting costs and limits: every visitor downloads the files, so heavy images use bandwidth and can push cheap hosting plans to their limits.
- Maintenance: a media library full of oversized originals makes backups, migrations and staging copies slower and larger.
The good news is that images are also the easiest part of a site to improve. A few habits at upload time often remove half the weight of a page.
What WordPress already does for you
Recent versions of WordPress handle several things automatically:
- It creates smaller copies of each image, typically around 150, 300, 768, 1024 and 1536 pixels wide, and adds a
srcsetattribute so browsers can choose the best one for each screen. - It scales down very large originals, with a threshold of 2560 pixels.
- It adds
loading="lazy"to images, so pictures below the first screen are fetched later. - It accepts WebP uploads, and recent versions also accept AVIF.
These features are useful, but they have a limit: WordPress works from the file you upload. If that file is uncompressed and huge, every generated copy is heavier than it should be. A theme that outputs the full-size image in a small slot also wastes bandwidth, and a plugin that lazy loads everything can slow down your most important image.
Three ways to optimize: manual, plugin or CDN
There is no single best approach. Most sites do best with a mix. Here is how they compare.
| Approach | Best for | Main upside | Main downside |
|---|---|---|---|
| Manual, before upload | New posts and a few images a week | Full control, no extra plugin, works on any host | Needs a habit and a few minutes per image |
| Optimization plugin | Large existing libraries | Bulk conversion, runs automatically on upload | Adds code to your site, may re-encode your files, some send images to outside servers |
| Image CDN or hosted service | Busy or global sites | Right size and format served per visitor, fast delivery | Monthly cost and a dependency on one provider |
Manual optimization
- Pros: you decide the exact size and quality, nothing runs on your server, and you can see the result before it goes live.
- Cons: it only helps images you handle yourself, so it does not fix an existing library, and it relies on everyone who publishes to follow the same steps.
Plugins
- Pros: they can process hundreds of old images, and they keep working without anyone remembering to do anything.
- Cons: each plugin adds code, settings and updates to maintain. Check whether it keeps your originals, whether you can undo changes, and whether images are sent to a third-party service, which matters for privacy and for client work.
CDNs and image services
- Pros: they convert formats and resize on the fly, so each visitor gets an appropriate file, and they speed up delivery.
- Cons: they cost money, add a dependency, and need correct setup so you do not break caching or image URLs.
A sensible default: optimize new images manually before upload, and use a plugin or CDN only to deal with the library you already have.
Step by step: optimize an image before upload
- 1Check your theme's content width. Most blog themes show inline images at 700 to 1200 pixels wide. Decide the largest width the picture will be shown at, and add a little room for sharp screens.
- 2Resize from the original. Use Resize Image to set the width. About 1600 px is enough for an inline image, and 2000 to 2500 px for a full-width hero. Keep the aspect ratio on, and always start from your best original rather than a copy that was already shrunk.
- 3Compress. Compress Image lets you pick a quality, with 75 to 85 working for most photos, or a target file size. Compare the preview with the original at full zoom, not as a thumbnail.
- 4Choose the format. Photos can be WebP or JPG. Graphics and screenshots can be PNG, or WebP if you want smaller files and need transparency. JPG to WebP and PNG to WebP handle the conversion in your browser. Keep a JPG copy if you also share the picture elsewhere.
- 5Rename the file. Change
IMG_4821.jpgto something likered-ceramic-teapot.jpg, in lowercase with hyphens between words. - 6Upload and fill in the details. In the media library add a short, accurate alt text. See image SEO for how to write one.
Dealing with the images you already have
You do not need to fix every old image. Start with the ones that matter most.
- Find the biggest offenders. Run your home page and top five posts through PageSpeed Insights and note the files it flags as too large or in an old format.
- Replace those files first. Download the original, resize and compress it, then re-upload it and swap it in. Replacing a handful of heavy images often does more than bulk-converting the whole library.
- Use a bulk tool carefully. If you use a plugin, test it on a copy of your site, confirm that originals are kept, and check a few pages afterwards for broken or blurry pictures.
- Regenerate sizes after a theme change. A new theme may use different image sizes, so thumbnails may need to be regenerated.
Common mistakes
- Uploading camera originals. A 6000-pixel photo shown in an 800-pixel column wastes most of its data.
- Compressing the same file repeatedly. Each lossy save loses a little more. Always work from the original. See lossy vs lossless compression.
- Lazy loading the hero image. The first large image should load immediately. The lazy loading guide explains why.
- Using PNG for photos. PNG is for graphics. A photo saved as PNG can be ten times larger than a JPG.
- Skipping alt text and sensible file names. They are small jobs with a real accessibility and search benefit.
How to check that it worked
Measure before and after so you know what you gained. Run the same pages through PageSpeed Insights or Lighthouse and compare the total size of images and the Largest Contentful Paint time. The Core Web Vitals report in Google Search Console shows what real visitors experience over weeks, so give it time to update. For a wider checklist, see the website image optimization checklist and the guide to how images affect Core Web Vitals.
Frequently asked questions
Should I use WebP in WordPress?
Yes, in most cases. WebP is typically 25 to 35 percent smaller than JPG at similar quality, every current browser supports it, and WordPress accepts WebP uploads. Keep a JPG copy of images you also use outside your site, such as in emails or social previews.
What size should a WordPress featured image be?
It depends on your theme, so check how wide it displays the featured image. A width of 1200 to 1600 pixels covers most blog layouts, and 2000 to 2500 pixels is enough for a full-width hero. Larger files add weight without visible benefit.
Do I need an optimization plugin?
Not necessarily. If you resize and compress images before uploading, WordPress's built-in features handle the rest. A plugin is most useful for cleaning up a large existing library or automating the process for several authors.
Why are my images still heavy after WordPress resizes them?
WordPress creates smaller copies but does not compress aggressively or choose the right dimensions for your layout. A huge original, or a theme that outputs a large size in a small slot, will still make the page heavy. Resize and compress before upload, and check which image sizes your theme uses.
Does compressing images hurt SEO?
No. Properly compressed images make pages faster, which helps. Just avoid very low quality settings that create visible blocks or blur, and keep alt text and descriptive file names in place.