Skip to content
Bulk orders? WhatsApp us
Toolsshark

Guides

Compressing images for the web without visible quality loss

Most images on the web are two to five times heavier than they need to be. A repeatable process — right size, right format, right quality — fixes that in minutes.

Published
29 Sept 2026
Reading time
2 min
By
Toolsshark Lab

Images are usually the largest part of a web page, and they are also the easiest part to fix. You do not need specialist software or a build pipeline to get most of the gains. You need to make three decisions in the right order: the pixel size, the format, and the quality setting.

1. Resize before you compress

Compression settings get the attention, but dimensions matter more. A photo straight from a phone is often 4000 pixels wide. If it is displayed in a column 800 CSS pixels wide, you need at most 1600 pixels to look sharp on high-density screens — about one sixth of the pixels, and roughly one sixth of the file size before any other optimisation.

  • Find the largest width the image is shown at in your layout.
  • Multiply by 2 for high-density displays. Going to 3× rarely produces a visible difference for photos.
  • Resize to that width, keeping the aspect ratio.

2. Choose the format by content, not habit

ContentUseWhy
PhotographsWebP or AVIF, JPEG as fallbackLossy formats handle continuous tone efficiently
Screenshots, UIWebP lossless or PNGSharp edges and flat colour show JPEG artefacts quickly
Logos, iconsSVGResolution-independent and usually tiny
TransparencyWebP or PNGJPEG has no alpha channel

WebP is supported by every current browser and is typically 25–35% smaller than an equivalent JPEG. AVIF can be smaller still, but encoding is slower and tooling support is less even, so WebP is the practical default.

3. Set quality by looking, then stop

For lossy formats, quality settings between 70 and 82 are where most photos stop showing visible differences at normal viewing size. Above about 85, file size rises steeply for changes almost nobody can see. Below about 60, artefacts appear in smooth gradients like skies and skin.

4. Strip what nobody sees

Camera files carry EXIF metadata — camera model, settings and sometimes GPS coordinates. Re-encoding through a canvas, as browser-based compressors do, drops this data. That saves a few kilobytes and, more importantly, avoids publishing where a photo was taken.

A repeatable workflow

  1. Resize to twice the largest display width.
  2. Export photos as WebP at quality 75–80; screenshots as lossless WebP or PNG.
  3. Compare against the original at display size.
  4. Name files descriptively and set width and height attributes in your HTML to prevent layout shift.

Toolsshark's Image Compressor runs these steps in your browser: set a maximum width, choose a format and quality, and see the output size before downloading. Nothing is uploaded.

Keep reading

All articles