Prompt LibraryPrompts
English

Image guides · 3 min read

How to Compress Images for a Faster Website

Images are usually the heaviest part of a web page. Sizes, formats and settings that make pages load quickly without blurry pictures.

On most pages, images make up more bytes than everything else together. A single hero photo straight from a camera can outweigh the page's text, fonts and scripts combined. Fixing images is usually the cheapest speed improvement a site can make, and it feeds directly into search: page experience is one of the signals Google reports on, and the Largest Contentful Paint metric is very often an image.

Step 1: send the size the page needs

The biggest saving is not compression, it is dimensions. If a picture appears 800 pixels wide on screen, a 4000 pixel file carries 25 times the pixels that can be shown. Work out the largest width an image is displayed at, and export about twice that for sharp results on high density screens. For a content column 800 pixels wide, 1600 pixels is plenty. For full width banners, 1920 to 2400 pixels is usually enough.

In the Image Compressor, set the longest side under More options, for example 1600 px, and every image you add is reduced to that before it is encoded.

Step 2: pick the format

  • Photographs: WebP, or JPG when you need maximum compatibility. WebP is generally noticeably smaller than JPG at the same visual quality, and all current browsers display it.
  • Logos, icons, screenshots, text: PNG, SVG for vector artwork, or lossless WebP.
  • Anything with transparency: PNG or WebP.

The comparison is explained in JPG vs PNG vs WebP.

Step 3: set a quality that does not show

For photographs, a JPG quality of 75 to 85, or WebP at a similar setting, is the usual sweet spot. Below about 60, smooth areas such as skies begin to show blocks. The Recommended mode sits in that range and never makes a file bigger than the original. Check one representative picture with the before and after slider at actual size, then process the rest with the same setting.

Step 4: file size targets

There is no official number, but these work well as budgets for a content page:

  • Inline article pictures: 60 to 150 KB each.
  • A full width hero image: under 250 KB if you can manage it.
  • Thumbnails and cards: 15 to 40 KB.

When one image misses its budget, use Exact size and type the target. The tool searches for the best quality that fits.

Step 5: tell the browser how to load them

Compression is half the job. In your HTML:

  • Add width and height attributes so the layout does not jump while images load, which affects Cumulative Layout Shift.
  • Use loading="lazy" for images below the fold, but never on the main image at the top of the page, which should load as early as possible.
  • Use srcset to offer a few widths so phones do not download desktop sized pictures.
  • Write a short, specific alt text. It helps accessibility and image search.

Keep your originals

Store the original files and export the web versions from them. If you recompress an already compressed JPG every time the design changes, quality drops each round. If you have lots of images, compress them in a batch and download the ZIP.

The same thinking applies to documents on a site: shrink PDFs with Compress PDF, so downloads are quick too.

Keep reading

All articles