How to optimise images for the web
By Ash, Founder, HosteazePublished 2 min read
The short answer
To optimise images for the web, resize each photo to roughly the largest width it will be shown at, save photos as WebP or JPEG and graphics with few colours as PNG or SVG, then compress them. WordPress then creates smaller versions automatically. Aim for a few hundred kilobytes for a hero photo, not several megabytes.

Images are usually the heaviest thing on a small business website, and the easiest to fix. A photo straight off a phone can be 4,000 pixels wide and several megabytes. Shown in a space 1,200 pixels wide, most of that data is thrown away by the browser after your visitor has waited to download it. Ten minutes with the right settings fixes it for good.
Which image format should I use?
| Format | Best for | Transparency | Notes |
|---|---|---|---|
| WebP | Photos and most images | Yes | Smaller than JPEG at similar quality; WordPress supports it since 5.8 |
| AVIF | Photos where every kilobyte counts | Yes | Usually smallest; WordPress 6.5+ if your server supports it |
| JPEG | Photos, maximum compatibility | No | MDN calls it the most popular format for lossy still images |
| PNG | Screenshots, graphics with flat colour and text | Yes | Large for photos; avoid for those |
| SVG | Logos and icons | Yes | Scales to any size; WordPress doesn't allow SVG uploads by default |
For most sites: WebP for photos, PNG for screenshots, SVG for your logo if your theme supports it.
How do I optimise an image step by step?
- Decide the largest width the image will appear at. A full-width hero might be 1,600 to 2,000 pixels; a photo in a blog post column around 1,200.
- Resize to that width in any image editor. On a Mac, Preview's Tools > Adjust Size works. On Windows, the Photos app's resize option does too.
- Open the free browser tool Squoosh (squoosh.app), drop in the resized image and choose WebP or MozJPEG.
- Lower the quality slider until you can just see a difference in the comparison view, then nudge it back up a little.
- Download the result and give it a descriptive file name, such as
oak-kitchen-worktop.webprather thanIMG_4032.webp. - Upload it to WordPress and write alt text describing what the photo shows.
What does WordPress do with images automatically?
Quite a lot, as long as you insert images through the editor:
- It creates smaller copies at its default sizes (thumbnail 150, medium 300, medium-large 768 and large 1,024 pixels wide) and adds them to the page so phones download a smaller file.
- Since WordPress 5.3, any upload wider or taller than 2,560 pixels is scaled down to that size and used as the largest version.
- It adds width and height to images, which stops the page jumping as they load. Google's web.dev lists images without dimensions as a common cause of layout shift.
- It lazy-loads images further down the page and, since 6.3, marks the likely main image to load first.
WordPress compresses the copies it creates at a default quality of 82 for JPEG and 86 for WebP. That's sensible, but it doesn't touch the original you uploaded, so resize before you upload.
How much difference does this make?
On image-heavy pages, often the biggest single improvement to Largest Contentful Paint. See how to improve Largest Contentful Paint for the details, and how to speed up WordPress for what to do next. Make sure you have the right to use every photo, too: how to get photos for your website legally explains the options.
Step by step
1.Resize
Resize each image to roughly the largest width it will be displayed at, for example 1,600 to 2,000 pixels for a full-width hero.
2.Choose a format
Use WebP or JPEG for photos, PNG for screenshots and graphics with few colours, and SVG for logos and icons.
3.Compress
Compress the image with a tool such as Squoosh, aiming for the smallest file that still looks sharp at full size.
4.Name and describe it
Give the file a descriptive name and add alt text describing what it shows.
5.Upload to WordPress
Upload the optimised file and insert it through the editor, so WordPress adds smaller sizes, dimensions and lazy loading.
Frequently asked questions
What size should images be for a website?
Size them to how they're displayed. A full-width hero might need 1,600 to 2,000 pixels wide to look sharp on large and high-resolution screens, while a photo in a blog post column rarely needs more than about 1,200. Thumbnails need far less. Uploading a 6,000-pixel camera original wastes space and upload time.
Should I use WebP or AVIF?
Both are much smaller than JPEG at the same quality. WebP is supported by WordPress since version 5.8 and works in all current major browsers. AVIF is usually smaller still and WordPress accepts it since 6.5, but only if your server's image library supports it. WebP is the safe default.
Do I need an image optimisation plugin?
Not if you resize and compress before uploading. A plugin helps if several people add images to the site, or you have hundreds of old images to fix, because it can compress and convert them automatically.




