Ctrl K

How to Compress Images for the Web

beginner TheToolSera Team 7 min read Updated 12 May 2026

Images are usually the heaviest thing on a web page, and most of that weight is avoidable. Compression works because photographs contain far more detail than a screen — or an eye — can resolve at display size.

Lossy vs lossless

Lossless compression (PNG, WebP lossless) rebuilds the exact original pixels and typically saves 5–30%. Lossy compression (JPEG, WebP, AVIF) discards detail the eye is least sensitive to and routinely saves 60–90%. For photographs, lossy is almost always the right answer.

Resize before you compress

This is the biggest single win and it is regularly skipped. A 4000 px photo displayed in a 800 px column carries 25 times more pixels than it can show. Resize to roughly twice the display width — enough for high-density screens — and then compress.

PlacementExport widthTypical size
Thumbnail300–400 px10–30 KB
In-article image1200–1600 px80–200 KB
Full-width hero1920–2400 px150–350 KB
Logo / iconSVG where possibleUnder 10 KB

Picking a quality level

  • Quality 80–85 — the sweet spot for photographs; differences are invisible at normal viewing distance
  • Quality 70–75 — acceptable for thumbnails and background imagery
  • Below 65 — banding in skies and halos around edges start to show
  • Above 90 — file size climbs steeply for detail nobody perceives

Judge quality at 100% zoom on the actual page, not in a full-screen preview. Compression artefacts that are obvious at 400% are irrelevant at display size.

Format matters as much as quality

  • Photographs — WebP or AVIF, with JPEG as a fallback
  • Screenshots, UI and flat colour — PNG or lossless WebP, which keep text crisp
  • Transparency — WebP, PNG or AVIF
  • Logos, icons, diagrams — SVG, which scales infinitely at a fraction of the size
  • Animation — animated WebP instead of GIF, often 80% smaller

How to compress an image in the browser

Compress an image locally

  1. 1

    Open the Image Compressor

    Open TheToolSera Image Compressor — the file is decoded in your own browser.

  2. 2

    Add the image

    Drop in a JPG, PNG or WebP file.

  3. 3

    Resize if needed

    Set the target width to match how the image is actually displayed.

  4. 4

    Adjust quality

    Start at 80 and compare the preview against the original.

  5. 5

    Download

    Save the optimised file, or convert it to WebP for a further saving.

Image Compressor

Compress and resize images with a live preview and size readout.

Try Image Compressor

Common mistakes

Using PNG for photographs

A photo saved as PNG can be ten times larger than the same photo as quality-85 JPEG, with no visible benefit.

Re-saving JPEGs repeatedly

Each save re-encodes and loses more detail. Always edit from the original, not from an exported copy.

Compressing without resizing

Quality settings cannot rescue an image that has four times too many pixels.

Serving one size to every device

Use srcset so phones download a small file and desktops get the large one.

Best practices

  • Strip EXIF metadata before publishing — it can include GPS coordinates
  • Keep an untouched master file and export derivatives from it
  • Automate compression in your build pipeline so it is never forgotten
  • Lazy-load images below the fold and set explicit width and height to avoid layout shift

Frequently asked questions

What quality setting should I use for JPEG?

Between 80 and 85 for most photographs. It removes the majority of the file size with no visible difference at display size.

Does compressing an image reduce its dimensions?

No — compression changes how pixels are stored. Reducing dimensions is resizing, and doing both gives the biggest saving.

Is WebP always smaller than JPEG?

Usually by 25–35% at equivalent quality, and it also supports transparency and animation. Support is universal in current browsers.

Can I compress images without uploading them?

Yes. Browser-based tools decode and re-encode with the Canvas API on your own device, so the file never leaves it.

Put this into practice

Image Compressor runs entirely in your browser — no upload, no account, no limits.

Open Image Compressor

Related tools

Related guides

All guides

Explore related topics