To optimize images in WordPress, start by resizing and compressing photos before you upload them, then use a tool that converts and compresses the images already in your Media Library. The safe way to fix old images is a process that replaces each file, regenerates WordPress's thumbnail sizes, updates every link to it and keeps a backup, so nothing in your existing posts breaks.
Key takeaways
- WordPress already makes resized copies, adds srcset and lazy loading, and prioritizes the likely hero image. It doesn't shrink your originals much or write alt text.
- Fix the habit first: upload photos at a sensible size.
- For old uploads, never swap files by hand. Use a process that relinks, regenerates and can revert.
- Check WebP and AVIF support in Site Health before converting a library.
What WordPress already does
Knowing the defaults stops you from paying for things you already have.
Resized copies. WordPress's reserved image sizes default to thumbnail (150 × 150), medium (300 × 300), medium_large (768 wide) and large (1,024 × 1,024). Themes and plugins often add more, which is why one upload becomes many files.
Big image scaling. Since WordPress 5.3, uploads larger than 2,560 px are scaled down to that threshold and saved with a "-scaled" suffix; the original file is kept in the uploads folder.
Responsive images. Since WordPress 4.4, images in content get srcset and sizes attributes built from the available sizes, so browsers can pick a smaller file.
Lazy loading and priority. WordPress 5.5 added loading="lazy" to images with width and height. WordPress 6.3 added fetchpriority="high" to the image it judges most likely to be the Largest Contentful Paint element, and refined which images are lazy-loaded.
Modern formats. WebP uploads have worked since 5.8, and AVIF since 6.5, when the server's image library (Imagick or GD) supports them.
What WordPress leaves to you
- The quality of your originals. A 2,560 px "-scaled" JPEG is still a large file if it was saved at high quality.
- Format conversion of existing uploads. Core doesn't convert your old JPEGs to WebP or AVIF.
- Alt text, titles and captions. The Media Library has fields for them, but they're empty unless someone fills them in. The list view's only bulk action is Delete Permanently, so there's no built-in way to edit text for many images at once.
- File names.
IMG_4382.jpgstaysIMG_4382.jpg.
Step 1: Fix new uploads at the source
Before uploading, resize photos to the largest width your theme displays (often 1,200 to 2,048 px for full-width images), compress them, and give them a descriptive file name. If your server supports it, upload AVIF or WebP. This one habit stops the library getting worse while you fix the backlog.
Step 2: Check what your server supports
Go to Tools > Site Health > Info > Media Handling. WordPress's developer note on AVIF points there: look for AVIF and WebP in the list of supported formats. WordPress's AVIF support depends on the server's image library, so if AVIF is missing, ask your host about it or stick with WebP.
Step 3: Take a backup
Before any bulk change to media, back up the uploads folder and the database. Any good optimization tool also keeps originals, but a full backup protects you from mistakes outside the tool.
Step 4: Test on a small batch
Pick 10 to 20 images that represent your library: a hero photo, a product shot, a screenshot, an old upload. Optimize them, then check:
- Do they look right at 100% zoom?
- Did the posts that use them still show them, in every size?
- Did file sizes actually drop?
- Can you revert one?
Step 5: Optimize the existing library in batches
What matters for old posts is what happens after the new file exists. A safe process:
- Replaces the original file with the optimized one.
- Regenerates every thumbnail size WordPress and your theme use.
- Updates every reference: post content, post meta, widgets and theme settings.
- Adds redirects from old URLs if file names or extensions change (for example
.jpgto.avif). - Keeps the original so the change can be reverted.
- Skips images that were already processed, so a second run doesn't recompress.
Run it in batches and spot-check a few pages after each one.
Step 6: Fill in the text
Alt text is the accessibility requirement and the field Google's image documentation calls most important. Prioritize images in content (not decorative ones), and write alt text that says what the image means on that page.
Our approach on WordPress
There are two ways to use Picture Optimizer with WordPress, depending on plan:
- Starter ($19 a month): optimize photos in the tool, then send them to your Media Library with their alt text. Good for new posts.
- Pro ($49 a month, 7-day trial): the WordPress plugin works through the photos already in your library. It replaces each original with the lighter file, regenerates thumbnails, updates every link with redirects for old URLs, skips images it has already done, and can revert any image. Encoding happens on our servers, not your host. It needs WordPress 5.8+ and PHP 7.4+.
The plugin page explains its three modes (Full at 2 credits an image, and Analyse only or Compress only at 1 credit each), and the WordPress image optimization page covers the whole workflow. If you run a blog, the WordPress blogs page shows the Starter workflow.
Keep reading
- How to serve WebP and AVIF in WordPress
- ShortPixel vs Imagify vs Smush: which WordPress optimizer fits your site?
Sources
- make.wordpress.org/core/2019/10/09/introducing-handling-of-big-images-in-wordpress-5-3
- developer.wordpress.org/reference/functions/add_image_size
- developer.wordpress.org/apis/responsive-images
- make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5
- make.wordpress.org/core/2023/07/13/image-performance-enhancements-in-wordpress-6-3
- make.wordpress.org/core/2021/06/07/wordpress-5-8-adds-webp-support
- make.wordpress.org/core/2024/02/23/wordpress-6-5-adds-avif-support
- wordpress.org/documentation/article/media-library-screen
Questions
Short answers to what people ask about this.