Skip to content

How-to guide · 5 min read

How to Compress Images for Your Website (Fast Pages, Sharp Photos)

Which format to use, what size to export at, and the quality settings that cut image weight by 70–90% with little visible difference.

GGuru GUpdated November 8, 2026

Why image size matters

Images are often the heaviest part of a web page. Oversized photos slow down loading — especially on mobile data — and can hurt Largest Contentful Paint, one of Google's Core Web Vitals.

1. Resize before you compress

A phone photo is often 4,000 pixels wide, but most layouts never show an image wider than about 1,200–1,920 pixels. Shrinking dimensions first removes most of the bytes.

  • Full-width hero: 1,920 px wide (2,560 px if you care about very large screens)
  • In-article image: 1,200 px
  • Thumbnail or card: 400–800 px

2. Pick the right format

  • WebP: best default for photos and graphics — widely supported and usually 25–35% smaller than JPEG at similar quality.
  • JPEG: the universal fallback for photos.
  • PNG: for screenshots, logos and images that need sharp edges or transparency; poor for photos.
  • SVG: for icons and logos that are drawn rather than photographed.

3. Choose a quality setting

For WebP and JPEG, quality 70–80 is a sweet spot for most photos. Below about 60, artefacts start to show around edges and in skies; above 85, files grow quickly with little visible gain. Always compare before and after at 100% zoom.

4. Keep layout stable

Set width and height (or an aspect ratio) on images in your HTML so the browser reserves space before the file loads. That prevents layout shift, another Core Web Vital. The Aspect Ratio Calculator helps you work out matching dimensions.

Privacy note

Many online compressors upload your photos to a server. Painkillers.io's Image Compressor runs entirely in your browser, and re-encoding also strips EXIF metadata such as GPS location.