Pixhush 100% in your browser · nothing uploaded
← All guides

How to compress images for the web

Most pages are heavy because of their images. Fixing that takes about five minutes per image.

Images are usually the largest thing a web page downloads, often by an order of magnitude over the HTML and CSS combined. Compressing them is the single highest-leverage speed fix available, and it does not require redesigning anything.

Start with dimensions, not quality

The most common mistake is compressing a 4000 pixel wide photo down to a small file instead of resizing it first. If the image is displayed 800 pixels wide, the extra 3200 pixels are pure waste, and no quality setting will recover that.

Resize first, compress second. A good rule: export at roughly twice the display width to stay sharp on high-density screens, so 1600 pixels for an 800 pixel slot. Our resize tool does this without uploading anything.

Which quality setting?

  • Quality 80 is the safe default for photographs. The difference from the original is invisible at normal viewing sizes.
  • Quality 60 to 70 is usually still fine for large background photos, where fine detail does not matter.
  • Below 50 starts to show visible artifacts on faces, skies and gradients. Avoid for anything a person will look at closely.
  • Lossless only for logos, screenshots, diagrams and anything with sharp edges or text.

Lossy or lossless?

Lossy compression throws away detail the eye is unlikely to notice, and that is exactly right for photographs. Lossless keeps every pixel and is right for flat graphics: a logo compressed lossily gets fuzzy halos around the edges, which looks cheap and saves very little.

The test is simple. Does the image have smooth gradients and natural texture? Lossy. Does it have hard edges, text or large areas of flat colour? Lossless.

How small is small enough?

There is no universal number, but useful anchors: a hero photograph under 200KB, a content image under 100KB, a thumbnail under 30KB. If a single image on your page is over 500KB, something is wrong with either its dimensions or its format.

If you need to hit a specific ceiling, the target-size tools do the search for you: compress to 100KB or compress to 500KB re-encode repeatedly and keep the best quality that fits.

Pick a modern format

Format choice often beats quality tuning. Converting a JPEG to WebP typically saves 25 to 35% at the same visual quality, and AVIF saves more again. See WebP vs AVIF vs JPEG for the trade-offs, then convert with JPG to WebP.

Everything here runs in your browser with our image compressor. Nothing is uploaded, so you can compress client work and private photos without them leaving your machine.

Browse all image tools