Images are often the heaviest part of a web page, so oversized photos can slow it down a lot. The good news is that most images can be made far smaller with no visible difference. This guide covers the three things that matter: dimensions, format and quality. Shrink yours with the image compressor.

Quick answer: Resize the image to roughly the size it will be shown, at most twice that width for sharp screens. Save photos as WebP or AVIF, or JPEG if you need compatibility, at a quality of about 70 to 80. Use PNG only for graphics that need to be lossless, and SVG for logos and icons.

1. Resize to the size you display

A photo straight from a phone is often 4,000 pixels wide or more. If it’s shown 800 pixels wide on your page, most of that data is wasted. Google’s web.dev guide warns that serving desktop-sized images to mobile devices can use 2 to 4 times more data than needed.

For sharp screens, which have 2 or 3 pixels for every CSS pixel, you need more, but not unlimited, pixels. An image shown at 600 pixels wide looks crisp on most phones and laptops at 1,200 pixels wide. Going from 2× to 3× more than doubles the pixels, from 4 to 9 times the 1× amount, for little visible gain.

Where the image goes Rough width to export
Full-width banner 1,600 to 2,000 px
Blog or article image 1,200 to 1,600 px
Product photo 1,000 to 1,500 px
Thumbnail or card 400 to 600 px
Email newsletter 600 to 1,200 px

These are starting points, not rules. Use the image resizer to set an exact width.

2. Choose the right format

Format Best for Notes
WebP Most photos and graphics on the web Generally smaller than JPEG and PNG, and supported by all modern browsers
AVIF Photos where size matters most Often smaller again than WebP, but slower to create
JPEG Photos where compatibility matters, such as email or uploads Works everywhere
PNG Screenshots, graphics with text, or images needing exact detail Lossless, so files are much bigger
SVG Logos, icons and simple illustrations Vector, so sharp at any size and usually tiny

Animated GIFs are very large and limited to 256 colours. A short video file is usually much smaller.

3. Set the quality

JPEG and WebP use “lossy” compression, which throws away detail you’re unlikely to notice. A quality setting of around 70 to 80 usually looks the same as the original at a fraction of the size. Below about 60, you’ll start to see blocky areas and blurred edges, especially in skies and skin. Compare before and after at the size the image will be shown, not zoomed in.

The image compressor lets you change the quality and format and see the new file size straight away. It works in your browser, so your images aren’t uploaded.

4. Serve the right size to each screen

If you build or edit your own pages, the srcset and sizes attributes let the browser choose the best file for each screen. Serving 3 to 5 sizes of each image is common:

<img src="photo-1200.webp"
     srcset="photo-600.webp 600w, photo-1200.webp 1200w, photo-1800.webp 1800w"
     sizes="(max-width: 700px) 100vw, 700px"
     alt="Describe the image"
     width="1200" height="800" loading="lazy">

Most website builders and WordPress do this for you when you upload a large enough image. Setting width and height stops the page jumping as images load, and loading="lazy" delays images below the screen until they’re needed. Don’t lazy-load the main image at the top of the page.

5. Remove hidden data

Photos can carry location and camera details in their EXIF data. Removing it saves a little space and protects your privacy. Check and clear it with the EXIF viewer and remover.

Quick checklist

More file tools are in the PDF and image tools guide, and see UK passport photo rules for official photo sizes.

Size and quality settings are starting points. The best result depends on the image, so always check by eye.

Frequently asked questions

How do I reduce an image's file size without losing quality?

Resize it to the size it will be shown, save it as WebP or JPEG at a quality of about 70 to 80, and remove EXIF data.

What is the best image format for websites?

WebP for most images, AVIF for the smallest photos, SVG for logos and icons, and PNG only when you need lossless detail.

What size should website images be?

About twice the width they are displayed at, so roughly 1,200 to 1,600 pixels for an article image.

Does reducing file size affect SEO?

Smaller images help pages load faster, which improves the experience for visitors and can help Largest Contentful Paint.

Is WebP supported everywhere?

All modern browsers support WebP. Some email apps and older software don’t, so use JPEG for email.

Should I use PNG for photos?

Usually not. PNG is lossless, so photos saved as PNG are much bigger than WebP or JPEG.

Sources

Last updated: