Skip to content

Images

How to Compress Images for a Website Without Losing Quality

Oversized images are the most common reason a page loads slowly. Here's how to pick the right format, size and quality so your images look sharp and load fast.

  • ToolsBench Team
  • 4 min read

A photo straight from a phone or camera is often 3 to 8 MB. On a web page it might be shown 800 pixels wide, so most of that data is downloaded and thrown away. Multiply by every image on the page and you have the single most common reason sites feel slow, especially on mobile data.

The good news: getting image weight down is mostly about three decisions, made in the right order.

Step 1: resize to the size you actually show

Compression gets the headlines, but dimensions matter more. A 4000 × 3000 pixel photo has twelve million pixels. Shown at 1200 pixels wide, it only needs about one and a half million. Resizing first can cut the file by 80 percent before you touch quality at all.

A good rule: make the image about twice as wide as the largest size it will be displayed at, so it stays crisp on high-density (retina) screens. For a full-width hero, 2000 to 2400 pixels wide is plenty. For an image in a blog post column, 1200 to 1600 pixels.

Use Image Resizer and keep the aspect ratio locked so nothing gets stretched.

Step 2: pick the right format

  • Photos: WebP or JPG. WebP is usually noticeably smaller than JPG at the same visual quality, and every current browser supports it.
  • Logos, icons and screenshots with sharp edges or text: PNG keeps edges crisp, or WebP, which also supports transparency. SVG is best of all for simple logos and icons.
  • Avoid PNG for photos. PNG is lossless, which makes photo files several times larger than they need to be.

To switch a batch of photos to WebP, use JPG to WEBP or PNG to WEBP.

Step 3: lower the quality, and watch the result

JPG and WebP let you trade a little quality for a much smaller file. The relationship isn't linear: going from 100 percent to 80 percent quality often halves the file with no visible change, while dropping much further starts to show artifacts such as blocky skies and smudged fine detail.

  1. Open the Image Compressor and drop in your image.
  2. Set the Quality slider. Start around 70 to 80 percent for photos.
  3. Click Compress. You'll see the result next to the original, with the before and after file sizes.
  4. Still too big? Lower the slider and click Compress again, as long as the result still looks right.
  5. Download when you're happy.

Two things the compressor does for you:

  • If you give it a PNG, it saves the result as WebP, because PNG has no quality setting to lower. It tells you when it does this.
  • If the compressed version would be bigger than your original (it happens with images that are already well optimized), it keeps the original instead of making things worse.

Everything runs in your browser, so the images aren't uploaded.

What "without losing quality" really means

Strictly, lossy compression always discards some information. The practical goal is that nobody can see the difference at the size the image is displayed. Judge that by viewing the result at its real display size, not zoomed to 400 percent. At normal size, a photo at 75 percent quality is very hard to tell from the original.

A quick checklist before you upload

  • Resized to roughly twice the display width
  • Photos as WebP or JPG; graphics as PNG, WebP or SVG
  • Quality between about 60 and 85 percent for photos
  • Descriptive file names (red-running-shoes.webp, not IMG_4021.webp). They help image search.
  • Alt text added in your website builder, describing the image for screen readers and search engines

Quick answers

What file size should a web image be? There's no single rule, but most content photos can land well under 200 KB, and large hero images under about 400 KB, without visible loss.

Should I use WebP or AVIF? WebP is the safe choice today, with universal browser support. AVIF can be smaller still, but encoding is slower and tool support is patchier.

Will compressing an image twice make it worse? Yes, each lossy save loses a little more. Keep your original and always compress from it.

Keep reading

More on Images