How to compress images for a website without visible quality loss

Pick the format, resize to the size you display, then lower the quality until you see a difference. A practical order of work, with measured sizes.

Images are usually the heaviest part of a web page, and most of that weight can be removed without anyone noticing. You do not need special software: three decisions, taken in the right order, do most of the work. Format first, dimensions second, quality last.

Why file size matters

A large image delays the moment visitors see the main content, uses their mobile data and costs you bandwidth. Google’s web.dev guidance points out that when an image is the largest element on the screen, its file size directly affects how fast the page appears to load (the Largest Contentful Paint metric). On many pages that element is a header photo.

The order that works

  1. Choose the format. Photos: WebP or JPEG. Screenshots, logos and graphics with text: WebP or PNG. The format guide compares them with measurements.
  2. Resize to the size you display. This often saves more than everything else together.
  3. Lower the quality until you can see a difference, then step back.

Doing it in another order wastes effort: there is no point fine-tuning the quality of an image that is three times too wide.

Resize before you compress

Dimensions matter more than the quality setting. A phone photo is often 4000 pixels wide; if your blog column is 800 pixels wide, the browser downloads around 25 times more pixels than it can show.

Measure the largest size the image is displayed at, then double it so it stays sharp on high-density screens. An image shown at 800 CSS pixels needs to be about 1600 pixels wide. Google’s web.dev guidance is the same: resize each image to the size it is displayed at, because extra pixels are downloaded but never seen.

Open the Image ResizerSet an exact width with the aspect ratio locked.

Find the quality floor

Lossy formats trade quality for size, and the relationship is not linear. Going from 95 to 80 cuts a lot of bytes with no visible change; going from 60 to 40 saves much less and adds visible blocks and smearing.

  1. Start at quality 80 and compare the result with the original at 100% zoom.
  2. Lower it in steps of 5 until you notice a difference in edges, skin, skies or text.
  3. Step back up one level. That is the floor for this image.

Photos with fine texture (foliage, gravel, fabric) need higher quality than smooth or flat images. If the result is larger than the original, the original was already well compressed: keep it. The Image Compressor tells you when that happens.

Close-up of a spoon saved as JPEG at quality 95: smooth reflections.JPEG 95
The same close-up at JPEG quality 60: very slight blockiness in the reflections.JPEG 60
The same close-up at JPEG quality 40: visible square blocks and colour smearing.JPEG 40
The same close-up at WebP quality 40: smoother than JPEG 40 but softer detail.WebP 40
A 100 × 100 pixel area of our sample photo, enlarged three times so the differences are visible. At normal size, quality 60 is hard to tell from 95; at 40, JPEG shows blocks and WebP smooths away detail.

What quality does to file size, measured

A quality number means slightly different things in different programs, so 80 in one app is not exactly 80 in another. Judge by the result on screen, not by the number.

Image Compressor with the sample photo loaded, WebP selected at quality 80, showing the original size, the compressed size and the change.
The Image Compressor shows the original size, the new size and the change as you move the quality slider.
Open the Image CompressorCompare sizes before and after, without uploading the image.

Metadata and privacy

Photos from phones often carry EXIF metadata, including the camera model and sometimes GPS coordinates of where the photo was taken. Toolora’s image tools redraw the image in your browser and save a new file, which does not include that metadata. That is usually what you want before publishing. If you need to keep copyright or colour-profile information, use desktop software that preserves it.

Common mistakes

  • Compressing from an already compressed copy. Each lossy save loses a little more. Keep the original and always start from it.
  • Saving photos as PNG “for quality”. PNG keeps the photo exactly, including its JPEG artefacts, in a much larger file.
  • Judging quality on a phone screen only. Small screens hide artefacts. Check on a large screen at 100% zoom.
  • Uploading the full-size image and letting the website shrink it. Some platforms do resize for you; many do not. If you are not sure, resize first.

Checklist

  • Photo or graphic? WebP or JPEG for photos, WebP or PNG for graphics.
  • Resize to about twice the displayed width, never larger than the original.
  • Compress from quality 80 and adjust by eye.
  • Set width and height attributes on the <img> tag so the page does not jump while it loads.
  • Add loading="lazy" to images below the first screen.

How these numbers were measured

We ran Toolora’s Image Compressor in Chromium 141.0.7390.37 on 25 October 2026, setting each format and quality in the tool and saving the file it produced. Samples: a 600 × 400 photo of an espresso cup by Rachel Michetti, released under CC0 and distributed with the scikit-image project, saved as JPEG at quality 95 (102 KB); and a 3200 × 2000 PNG screenshot of Toolora’s own Merge PDF page (264 KB). Other photos will give other sizes, but in the same direction.

Questions and answers

What quality setting should I use?

Start at 80 for photos and check the result at 100% zoom. Many photos look the same down to about 70. Go lower only if you have checked fine detail such as hair, foliage and text, because artefacts appear there first.

How wide should an image on my website be?

As wide as the largest size it is displayed at, multiplied by the screen density you want to support. An image shown 800 pixels wide looks sharp on most high-density screens at 1600 pixels. Anything beyond that is downloaded but never seen.

Does compressing remove EXIF data and location?

Yes. Images are redrawn and saved again by your browser, which does not copy EXIF metadata such as camera details and GPS location into the new file.

Can I compress the same JPEG several times?

Avoid it. Every lossy save throws away a little more detail. Keep the original and always compress from it, not from an earlier compressed copy.

Why is my compressed PNG not smaller?

PNG is lossless, so there is no quality to lower, and saving it again in a browser can even make it larger: our 3200-pixel screenshot went from 264 KB to 419 KB. To make a PNG lighter, reduce its width or save it as WebP.

Sources

  1. Serve images with correct dimensions, web.dev (Google)
  2. Choose the right image format, web.dev (Google)
  3. Image file type and format guide, MDN Web Docs
All guides