How to compress images for a website without losing quality

Large photos are the top reason websites load slowly. How to pick the right size, format and quality so pages load fast and pictures still look sharp.

Compress imageShrink JPG, PNG and WebP files while keeping them sharp. Free, no upload.
Compress image on AllFreeImage with a photo open
Compress image on AllFreeImage

Why image size matters

On most websites, images make up more than half of everything a visitor downloads. A single photo straight off a phone is 3 to 6 MB, which can take several seconds on a mobile connection. Google measures how fast the largest thing on the page appears, and that is very often a photo.

The fix is two separate steps that people often mix up: make the picture the right number of pixels, then save it at a sensible quality.

Step 1: resize to the size it is shown at

A photo shown in a 1200 pixel wide column does not need to be 4000 pixels wide. Open Resize image and set the width to the largest size the image will appear on screen, doubled for sharp phone and laptop screens up to a limit. For a full-width hero, 2000 to 2400 pixels is plenty. For a blog body image, 1600. For a thumbnail, 600 to 800.

Resizing alone usually cuts the file by 70 to 90 percent.

Step 2: compress at the right quality

Open Compress image and choose a format and quality. For photos, WebP at 75 to 82 percent looks the same as the original to almost everyone and is a quarter to a third smaller than a JPG of the same quality. Hold the Compare button on the preview to flick between the original and the result.

If you have a hard limit, such as a CMS that refuses files over 500 KB, switch to Target size and type the limit. The tool finds the highest quality that fits.

Which format to use

Photos: WebP, or AVIF if your site supports it. Logos, icons and screenshots with flat color and text: PNG, ideally with Reduce colors turned on, or SVG for logos. Avoid PNG for photos; it keeps every pixel exactly and produces files five to ten times larger than WebP.

A quick checklist

Resize first, then compress. Aim for under 200 KB for most images and under 400 KB for a large hero. Give every image a width and height in your HTML so the page does not jump while it loads, and write alt text that describes what is in the picture.

What we measured

We took six full-size photos (a street, a plate of food, a parrot, a sunset, a portrait and a parked car) and saved them with the same encoder this site uses. The table shows the average file size. Two things stand out: pixel size matters more than quality, and the last few percent of quality are extremely expensive.

Detailed photos cost more than calm ones. At 1600 pixels and 80 percent, the portrait with a plain background was 75 KB and the cobbled street was 278 KB. A fixed target for every image is therefore a rough guide, not a rule.

Saved asAverage size
JPG 80%, 4000 px wide1,126 KB
JPG 80%, 2400 px389 KB
JPG 80%, 1600 px182 KB
JPG 80%, 1200 px108 KB
JPG 80%, 800 px54 KB
JPG 90%, 1600 px293 KB
JPG 100%, 1600 px1,604 KB
WebP 80%, 1600 px111 KB
PNG, 1600 px3,166 KB
Average of six photos, longest side as shown, December 2026.

Common mistakes

Uploading the camera file and letting the page shrink it: the visitor still downloads every pixel. Saving a photo as PNG because it sounds higher quality: our test photos were 17 times larger that way. Compressing a file that has already been compressed: start from the original each time. And judging quality at 300 percent zoom: look at the picture at the size visitors will see it.

If you use a website builder

WordPress, Shopify, Squarespace and Wix all make smaller copies of what you upload, but they work from your file. Uploading a clean 2400 pixel image at 85 percent gives them enough to work with without filling your storage. Check one page afterwards with PageSpeed Insights from Google; it lists the images that are still too heavy.