← All articles
Images24 Apr 20265 min read

Compress images for the web without losing quality

Heavy images are the most common reason pages feel slow. Here's how to shrink them while they still look sharp.

Oversized images are the quiet killer of page speed. A single 4 MB hero photo can do more damage to load time than all your code combined. The good news: most images can be made dramatically smaller with no visible difference.

Right-size before you compress

The single biggest win is dimensions. If an image displays at 800 pixels wide, it doesn't need to be 4000 pixels wide. Resize it to roughly the size it's actually shown (allowing for high-density screens) before doing anything else.

Pick the right format

  • Photos: modern formats like WebP or AVIF beat JPEG at the same quality.
  • Logos, icons, flat graphics: SVG if possible; otherwise PNG.
  • Anything with transparency: PNG, WebP or AVIF — not JPEG.

Lean on lossy compression

For photographs, lossy compression throws away detail your eye won't miss. Dropping quality from 100% to around 80% often halves the file size with no perceptible change. Always eyeball the result — the right setting depends on the image.

Do it in your browser

You don't need to upload images to a stranger's server to compress them. Browser-based tools do the work on your own machine, which is faster and keeps the file private. Shrink it, check it, download it — done.

Try it yourself

Every tool in this guide lives in Trebevo — one login, free to start.

Start free