Skip to content

How to optimise images for the web

By Ash, Founder, HosteazePublished 2 min read

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.

Two camera lenses resting on a heap of old black-and-white photographs.
Credit: jarmoluk via Pixabay

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?

FormatBest forTransparencyNotes
WebPPhotos and most imagesYesSmaller than JPEG at similar quality; WordPress supports it since 5.8
AVIFPhotos where every kilobyte countsYesUsually smallest; WordPress 6.5+ if your server supports it
JPEGPhotos, maximum compatibilityNoMDN calls it the most popular format for lossy still images
PNGScreenshots, graphics with flat colour and textYesLarge for photos; avoid for those
SVGLogos and iconsYesScales 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?

What does WordPress do with images automatically?

Quite a lot, as long as you insert images through the editor:

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. 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. 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. 3.Compress

    Compress the image with a tool such as Squoosh, aiming for the smallest file that still looks sharp at full size.

  4. 4.Name and describe it

    Give the file a descriptive name and add alt text describing what it shows.

  5. 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.

Sources

  1. MDN Web Docs, Image file type and format guide
  2. Make WordPress Core, Introducing handling of big images in WordPress 5.3
  3. Make WordPress Core, WordPress 6.5 adds AVIF support
  4. web.dev, Optimize Cumulative Layout Shift
A blank white billboard standing in a field under a bright sky, as empty as a website showing the white screen of death.QuestionHow to fix the WordPress white screen of deathThe WordPress white screen of death is a blank page, or a "There has been a critical error" message, caused by a PHP error. A faulty plugin or theme is the usual culprit, often straight after an update. Check your admin email for a recovery mode link, or rename the plugins folder by SFTP to switch every plugin off.WordPress speed · 24 November 2026A pane of window glass with a hole punched through it and cracks spreading outwards, the aftermath of a break-in.GuideMy WordPress site has been hacked - what do I do?If your WordPress site is hacked, stay calm and work in order. Write down what you're seeing, change every password and reset the security keys in wp-config.php, then restore a clean backup or replace WordPress files with fresh copies. Update everything, scan your own computer, and request a review in Google Search Console if Google has flagged the site.WordPress speed · 23 November 2026A country track splitting into two paths between autumn trees, a choice between two routes to the same place.ComparisonWordPress.com vs WordPress.org - what's the difference?WordPress.org is the free, open-source WordPress software that you install on hosting you choose, with full control over plugins, themes and data. WordPress.com is a commercial service run by Automattic that hosts WordPress for you, with features tied to its plans. Choose WordPress.org for ownership and flexibility, WordPress.com if you want everything handled by one company.WordPress speed · 21 November 2026A chalkboard sign reading "open" hanging on a weathered shop door beside a window.QuestionWhat are the hosting requirements for WooCommerce?As of October 2026, WooCommerce recommends WordPress 6.9 or greater, PHP 8.3 or greater, MySQL 8.0 or greater (or MariaDB 10.6 or greater), HTTPS support and a WordPress memory limit of at least 256 MB. Beyond those minimums, a shop needs hosting with enough resources for checkout traffic, plus caching that leaves the cart and checkout alone.WordPress speed · 19 November 2026Lorries and cars queued nose to tail on a motorway, the way requests pile up on an overloaded website.QuestionWhy is my WordPress site slow?Most slow WordPress sites have one of five problems - oversized images, no page caching, a heavy theme or plugin, an old PHP version, or a server that responds slowly. Test the page in PageSpeed Insights, check Tools, Site Health in your dashboard, then switch plugins off one at a time to find the culprit before you change anything else.WordPress speed · 17 November 2026

Hosting made for WordPress

See how our WordPress hosting is set up.

See WordPress hosting