How to optimize images in WordPress (WebP and compression)
Images are usually the heaviest part of a WordPress page, so they are the first thing to fix when a site is slow. This guide shows you how to optimize images in WordPress: resizing before upload, compressing, converting to WebP, and lazy loading, using tools that work well on EgWeb's LiteSpeed hosting.
1. Resize before you upload
- Do not upload photos straight from a phone or camera; they are often 4000+ pixels wide and several megabytes.
- Resize to the largest size the image will actually display. For most full-width images 1920 px wide is enough; for content images 1200 px is usually plenty.
- Use JPEG (or WebP) for photos, PNG only for images that need transparency or sharp text, and SVG for simple logos and icons (only from trusted sources).
WordPress automatically creates smaller sizes (thumbnail, medium, large) and serves the right one with srcset, so the original upload size still matters but is not the only one used.
2. Compress and convert to WebP
WebP files are usually much smaller than JPEG or PNG at similar quality, and all modern browsers support them. You can optimise automatically with a plugin:
| Tool | Notes |
|---|---|
| LiteSpeed Cache | Built for LiteSpeed servers. Its Image Optimization section sends images to QUIC.cloud for compression and can create WebP versions and serve them automatically. |
| Converter for Media | Converts existing and new images to WebP on your server. |
| ShortPixel, Imagify, EWWW | Popular compression services with free and paid limits. |
Use one image optimisation plugin only; two will process the same files twice.
3. Set up image optimization in LiteSpeed Cache
- Install and activate LiteSpeed Cache from Plugins > Add New if it is not already active.
- Open LiteSpeed Cache > Image Optimization. Image optimisation uses QUIC.cloud, so follow the prompt to link your domain to QUIC.cloud.
- In the image optimisation settings, enable automatic optimisation and WebP creation, and enable the option to replace images with WebP on the front end.
- Click to send an optimisation request. Images are processed in batches, and the summary page shows progress.
- Purge the cache when finished.
4. Lazy load images
- WordPress adds
loading="lazy"to most images automatically, so images below the fold load only when the visitor scrolls. - LiteSpeed Cache also has a lazy-load option under its page optimisation settings. Use one method, and exclude your logo and the main (hero) image at the top of the page so they appear immediately.
- Always set width and height on images (WordPress does this for media library images) to prevent the layout from jumping.
5. Measure the result
- Test a page in PageSpeed Insights before and after.
- Look at "Properly size images", "Serve images in next-gen formats" and "Largest Contentful Paint".
- For more speed improvements see how to speed up your WordPress website.
Common problems
- Images still show as JPG/PNG: the WebP replacement option is off, or a cache is serving old pages. Purge all caches including Cloudflare.
- Images look blurry: the compression level is too aggressive or the uploaded image is smaller than its display area. Use lossless/less aggressive settings or upload a larger original.
- Disk space keeps growing: backups of originals and WebP copies take space. Remove originals only after you are happy with the results and have a full site backup.
- Upload fails for large images: resize first, or check the upload limit with our upload guide.
Frequently asked questions
Does WordPress support WebP uploads?
Yes, current WordPress versions accept WebP images in the media library.
Will converting to WebP delete my original images?
Normally no. Most plugins keep the original and add a WebP copy, then serve WebP to browsers that support it.
How small should an image be?
As a rough guide, try to keep most content images under about 200 KB and large hero images reasonable for their size. Quality that looks good to the eye is the real target.
Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.