G-10 · Images · 6 min read

How to reduce image size for a faster website

Resize, compress and choose the right format for website images so pages load quickly, with sensible target sizes and a few lines of HTML that help.

Updated Uses Resize Image, Compress Image, Image Converter
Fig. G-10 · Images

Images are usually the heaviest part of a web page, and an oversized photo is the easiest performance problem to fix. A 5 MB photo straight from a phone, shown in a column 800 pixels wide, makes every visitor download far more than they will ever see. This guide walks through the three steps that make the biggest difference: resizing images to the size they're displayed at, compressing them, and picking the right format. It finishes with a few lines of HTML that help the browser load them efficiently.

Step by step

  1. Work out the display size. Check how wide the image appears on your site at its largest, for example 800 px for a blog column or the full width of a hero banner. Your browser's developer tools show an image's rendered size when you inspect it.
  2. Resize. Open Resize Image, add your images (up to 200 at once), choose Pixels, and enter the target width. Keep Keep aspect ratio on, so the image is scaled to fit within the width and height you enter without being stretched. You can also scale by Percentage.
  3. Compress. Open Compress Image, add the resized images, and set Quality. 75%, the default, is a good starting point for photos.
  4. Check the format. Photos should be JPG. Screenshots, logos and graphics should be PNG, or WebP made with Image Converter. See below.
  5. Compare. Look at the result at actual size next to the original. If you can't see a difference, try a slightly lower quality; if you can, go back up.

Tip If one of Compress Image's Max dimension presets fits your layout (3840, 1920, 1280 or 800 px on the longest side), you can skip the separate resize step. Compress Image scales the image down and compresses it in a single pass.

All three tools run in your browser through WebAssembly, so for typical files your images are not uploaded. Jobs up to about 400 MB run on your device; only larger ones can move to the cloud, where they are processed in an isolated sandbox and deleted automatically.

Resize first: it matters more than anything else

File size grows with the number of pixels. Halving an image's width and height leaves a quarter of the pixels, and usually brings the file size down by a similar amount, before any compression at all. No compression setting can match that.

How large should images be? The browser needs roughly as many pixels as the image occupies on screen, multiplied by the screen's pixel density. Most phones and many laptops have high-density displays, with two or three device pixels per CSS pixel. A practical approach:

  • Content images in a column up to 800 px wide: export at around 1600 px wide, which stays sharp on high-density screens.
  • Full-width hero images: around 1920 to 2560 px wide is usually plenty.
  • Thumbnails and avatars: twice their displayed size, so a 120 px avatar would be 240 px.

If you want to serve different sizes to different screens, which is the best option for large images, create two or three versions and use srcset (shown below). Resize Image uses Lanczos resampling, a high-quality method that keeps edges sharp when scaling down. It saves the image in its original format, and the file name records the new dimensions, such as photo-1600x1067.jpg. The aspect ratio calculator helps if you need to work out a matching height for a given width.

Compress: what the quality setting does

Compress Image keeps each image in its current format and works differently for each one:

  • JPG is re-encoded at the quality you choose, from 10% to 95%. For photos on the web, 70–85% is usually indistinguishable from the original at normal viewing size, and often far smaller.
  • PNG is saved with maximum lossless compression. Below 90% quality, the tool also tries reducing the image to a palette of up to 256 colours and keeps that version if it's smaller. This is very effective for screenshots, icons and flat illustrations, and can show banding in photos or smooth gradients. BMP and TIFF files are saved as optimised PNG.
  • WebP images are saved losslessly.

If compression wouldn't make a file smaller and you haven't changed its dimensions, you get the original back rather than a larger file.

A reasonable target is a few hundred kilobytes at most for a large hero photo, and well under that for images within an article. Screenshots and simple graphics can often be tens of kilobytes. These aren't hard rules, but if an image is measured in megabytes, there's almost certainly room to shrink it.

Pick the right format

Image type Format Why
Photos JPG at 70–85% Smallest practical size for natural images
Screenshots, UI, diagrams PNG (palette) or lossless WebP Sharp edges and text stay crisp
Logos and icons with transparency PNG, lossless WebP, or SVG Keeps the transparent background
Simple shapes and logos you have as vectors SVG Scales to any size at a tiny file size

WebP is supported by every current major browser, and in lossless mode it is usually smaller than the equivalent PNG. Image Converter produces lossless WebP, which makes it a good replacement for PNG graphics on a site. It doesn't produce lossy WebP, and for photographs lossless WebP is generally larger than a compressed JPG, so keep photos as JPG. If you want lossy WebP or AVIF, which can be smaller still for photos, image tools such as Squoosh or the cwebp and avifenc command-line encoders can produce them. The guide to PNG, JPG and WebP explains the differences in detail.

HTML that helps

Smaller files are the biggest win, but a few attributes make sure the browser uses them well:

<img
  src="photo-1600.jpg"
  srcset="photo-800.jpg 800w, photo-1600.jpg 1600w"
  sizes="(max-width: 800px) 100vw, 800px"
  width="1600" height="1067"
  loading="lazy"
  alt="Two hikers on a ridge above a valley at sunrise">
  • width and height let the browser reserve space before the image loads, which prevents the page from jumping as images appear.
  • srcset and sizes let the browser choose the smallest file that will look sharp on the current screen.
  • loading="lazy" delays loading images further down the page until the reader scrolls near them. Don't use it on the main image at the top of the page, which should load as early as possible.
  • alt describes the image for screen reader users and appears if the image fails to load. It's an accessibility requirement, not an optional extra.

If your site runs on a platform or content management system, check whether it already generates resized versions and srcset for you. Many do, in which case uploading a sensibly sized original (say 2000–2500 px wide) is enough, and you can skip the manual resizing. Images aren't the only thing worth trimming, either: the CSS minifier handles stylesheets.

FAQ

Common questions.

01Should I resize or compress first?

Resize first, then compress. Resizing removes the most data, and compressing the smaller image is faster and gives you a fair look at the final quality. Resize Image saves JPGs at a high quality (92%), so very little is lost before the compression step. If a Max dimension preset in Compress Image suits you, it does both at once.

02Will compressing images hurt my search rankings?

No. Faster pages are generally better for visitors, and search engines take page experience into account. What matters for search is that images are relevant, have descriptive file names and alt text, and look good. Sensible compression keeps them looking good.

03Why does my compressed PNG look blotchy?

Below 90% quality, Compress Image may reduce a PNG to a 256-colour palette. That's ideal for screenshots and flat graphics, but photos and smooth gradients need more colours and can show banding. Raise the quality to 90% or above to keep full colour, or save photos as JPG instead.