Skip to content Opens in a new tab

How to Optimise Images for Web Without Losing Quality

Want this done for you? Start with a free website audit.

To optimise images for web use, resize each image to the largest size it’s actually shown at, compress it, and save it in a modern format such as WebP or AVIF. Then add width and height attributes and lazy-load anything below the first screen. Done properly, that turns a 3.6 MB camera photo into a file under 100 KB without losing quality you can see. It matters because images are the heaviest part of most pages. The HTTP Archive Web Almanac 2025 found the median mobile home page loads 911 KB of images.

We ran one real photo through the sizes, formats and compression settings that work, and the results are shown at each step. If you’d like to know how your own site’s images are doing, our free website audit checks them along with speed and SEO.

Six zoomed tiles of the same 1200 pixel photo saved as PNG, JPEG at three quality levels, WebP and AVIF, with file sizes

Image size vs image file size, and why it matters

People mix these up all the time, so it’s worth being clear. Image size is the dimensions, such as 1200 by 800. File size is how much data the file holds, in KB or MB. That’s what visitors have to download, and it’s what slows the page load time.

Does a bigger file size mean better quality? Only up to a point. Once an image has enough detail for the space it fills on screen, the browser throws the rest away. A 5,000 px wide photo in a 1,200 px slot looks no better than a well-made 2,400 px one, it just takes longer to arrive. On a phone over a patchy connection, that’s the difference between a page that appears straight away and one people leave.

What is the best image size for a website?

There’s no single best size, because it depends on where the image goes. A good rule is to make the image twice the width it’s displayed at, so it stays sharp on high-resolution screens, and no bigger.

Where the image goes Width to export File size to aim for
Full-width hero or header image 1,920 to 2,400 px Under about 200 KB
Image inside the text column 1,200 to 1,600 px Under about 100 KB
Cards, thumbnails, team photos 400 to 800 px Under about 50 KB
Logos and icons Use SVG A few KB

Those targets are rules of thumb. A detailed photo may need a bit more. What matters is that you resize before you compress, because resizing does most of the work.

Bar chart of one photo's file size at widths from 5472 to 800 pixels, falling from 3.6 MB to 74 KB

In this test, the camera original was 3.6 MB at 5,472 px wide. Simply re-saving it at quality 80 only got it to 2.5 MB. Resizing it to 1,200 px at the same quality brought it down to 156 KB. Halve the width and the file drops to roughly a quarter, because there are four times fewer pixels.

Choosing the right format, from PNG and GIF to WebP

Format Best for Notes
JPEG (JPG) Photos when you need maximum compatibility Lossy, no transparency, supported everywhere
PNG Screenshots, graphics with text, transparency Lossless, so photos saved as PNG are huge
WebP Most photos and graphics on the web today Lossy or lossless, supports transparency
AVIF Photos where you want the smallest file Smallest files, slower to encode
SVG Logos, icons, simple illustrations Vector, sharp at any size
GIF Avoid where you can Use a short video or animated WebP instead

Google’s own figures say WebP lossless images are 26% smaller than PNGs and lossy WebP images are 25 to 34% smaller than comparable JPEGs. The WordPress core team says AVIF images can be up to 50% smaller than JPEGs at the same quality. In our test above, the 1,200 px photo was 156 KB as a JPEG, 94 KB as WebP and 58 KB as AVIF.

Bar chart of the formats used for the main LCP image on web pages, with JPEG at 57%, PNG 26% and WebP 11%

Most sites haven’t caught up. The 2025 Web Almanac found 57% of pages still use JPG for their main image and 26% use PNG, with only 11% on a modern image format. Switching that one image is often the quickest win on the page.

Image compression without losing quality

Compression comes in two kinds. Lossless compression shrinks the file without changing a single pixel. Lossy compression throws away detail your eye won’t miss, and saves far more. For photos on the web, lossy is the right choice nearly every time.

The trick is the quality setting. In the comparison at the top, quality 95 was 348 KB and quality 80 was 156 KB, and at normal viewing size they look the same. At quality 40 it fell to 78 KB but blocky marks start to show around edges. For most photos, a quality of 75 to 85 is the sweet spot, and it’s the balance between image quality and file size that matters.

Free online image tools and Photoshop

These do the job well.

  • Squoosh, a free online image tool from Google Chrome Labs that shows the before and after side by side as you move the quality slider.
  • TinyPNG, an image compressor that handles the common formats and converts between them, up to 20 images at a time on the free version.
  • Photoshop’s Export As, or any image editing app that lets you choose format and quality when you save.

Whatever you use, keep the original. Compressing an already compressed image again makes it worse each time.

Responsive images and lazy loading images below the fold

Even a well-compressed image is wasted if a phone downloads the desktop version. Responsive images fix that. The srcset attribute lists several sizes of the same image and the browser picks the smallest one that looks sharp on that screen. Google’s image SEO guidance recommends keeping a normal src as a fallback.

PageSpeed Insights Improve image delivery audit for wordpress.org showing an image uploaded at 768 pixels but displayed at 372

PageSpeed Insights flags this under “Improve image delivery”. In this run on the WordPress.org home page, one image was served at 768 pixels wide but shown at 372, and the page could have saved 620 KiB of image data across all its images.

Two more attributes matter. Add width and height to every image so the browser reserves the space, which stops content jumping around as images arrive. And add loading="lazy" to images below the first screen so they only load when someone scrolls to them. Never lazy-load the main image at the top of the page, because that delays the moment your page looks loaded. Our guide to Core Web Vitals explains how images affect those scores.

How to optimise images in WordPress with a plugin

WordPress handles a lot of this for you. It makes several copies of each upload at the sizes set in Settings, Media (and any sizes your theme adds), writes the srcset for you and lazy-loads images below the first screen.

WordPress Media Settings screen with the thumbnail, medium and large image sizes highlighted

What it doesn’t do on its own is compress well or convert to modern formats. An image plugin handles that, compressing new uploads automatically and processing your existing media library in bulk. Resize big photos before you upload them too. Our WordPress speed optimisation guide compares the plugins worth using, and our WordPress support team can set it up and clean up an existing library for you.

Image SEO best practices

Optimising images for search is mostly about helping search engines understand them. Use a descriptive filename (london-skyline-thames.jpg, not IMG_4021.jpg), write alt text that says what the image shows, and use a format Google supports. Google Search supports BMP, GIF, JPEG, PNG, WebP, SVG and AVIF. Alt text also helps people using screen readers, so write it for them first.

Common questions

Is PNG or JPEG better for websites?

JPEG for photos, PNG for screenshots, graphics with sharp text and anything that needs a transparent background. Better still, use WebP for both, which is smaller than either.

What is a good size for a website header image?

Export a full-width header at 1,920 to 2,400 px wide and compress it to roughly 200 KB or less. If your theme crops it on mobile, check the crop on a phone before publishing.

Does a bigger file size mean better quality?

Not on a website. Past the size the image is displayed at, a bigger file just takes longer to download. A properly resized and compressed image looks the same to visitors and loads many times faster.

How do I know the size of an image on a website?

Right-click the image and choose Inspect. Chrome’s developer tools show its real dimensions next to the size it’s displayed at, and the Network tab shows its file size. PageSpeed Insights also lists images that are bigger than they need to be.

Ways to optimise images for web use, a quick checklist

  1. Resize to twice the displayed width, and no bigger.
  2. Pick the format by content. Photos in WebP or AVIF, logos in SVG, screenshots in PNG or WebP.
  3. Compress at quality 75 to 85 and check the result at normal size.
  4. Add width and height, and lazy-load everything below the first screen except the main image.
  5. Write a descriptive filename and alt text.
  6. Run a speed test in PageSpeed Insights and fix anything flagged under image delivery.

What to do next

Start with your biggest images, usually the home page hero and any sliders. Work through the checklist and test again. If you’re planning a new site, our web design team builds image handling in from the start. Or get a free website audit and we’ll show you which images are slowing your site down.

Add as a preferred source on Google

Want to know what your website needs?

Our free website audit checks every page for speed, search, tracking and enquiry journeys, and ranks each issue by what matters most. You get it in one working day.

More Articles From Our Blog

Website Down? What to Do Before Your Customers Notice

Website Down? What to Do Before Your Customers Notice

Check the site is down for everyone, read the error, then send it to the right person. Who fixes which error, what to do about an expired domain…
Read article →
GEO vs SEO vs AEO and the Difference for Your Website

GEO vs SEO vs AEO and the Difference for Your Website

SEO ranks your pages, AEO makes them the direct answer and GEO gets them cited in AI answers. For most teams it is one job on the same…
Read article →