Skip to content
Image Reshaper

← Guides

Maintained by Image Reshaper · Updated

How to Optimize Images for Website Speed

Image weight is usually the largest part of a page. Here is how to size, format, and compress images so pages load fast on mobile networks.

Send only the pixels your layout can use

Resize an image to suit its largest rendered size and expected display density, then compare JPG and WebP output. Use PNG where lossless edges or compatibility matter. A smaller encoded file reduces transfer bytes, but it does not by itself prove a faster page or passing Core Web Vitals.

A 600 CSS-pixel slot may benefit from a 1200-pixel source on a 2× display. That is a layout decision, not a universal size recommendation. Avoid serving a huge camera original to every screen.

Optimize and measure the real page

The examples below compare our actual browser encodings. These are local fixture results, not network-speed measurements or forecasts for your site.

Declare image width and height in your page to reserve space. Use responsive image sizes for different layouts. Do not lazy-load the main above-the-fold image simply to reduce initial requests.

  1. Resize a copy to the display dimensions you need.
  2. Convert to WebP or JPG and inspect the result; keep transparency if required.
  3. Compare output bytes and visual quality, not the quality number alone.
  4. Install the image, then measure the page on a mobile connection and review field performance when available.

Try our measured examples

Created and tested on 2026-10-06 in Chrome 154.0.8037.98. These images were generated by this project. Results vary with source content and browser encoder; no camera photograph was used.

Actual encoded output sizes, in bytes
ExampleOriginal bytesOutput bytesDimensionsQuality
texture-80.jpg2,457,363463,1401200 × 80080%
texture-80.png2,457,3632,457,3631200 × 800Not applicable
texture-80.webp2,457,363472,8721200 × 80080%
graphic-80.jpg38,17322,3291200 × 80080%
graphic-80.png38,17338,1731200 × 800Not applicable
graphic-80.webp38,1738,4421200 × 80080%
transparent-80.jpg38,15822,3101200 × 80080%
transparent-80.png38,15838,1581200 × 800Not applicable
transparent-80.webp38,1588,5541200 × 80080%

Download the originals: textured JPG, textured PNG, flat graphic, transparent graphic. Run them through the tool to compare your browser’s result.

Transparent graphic converted to JPG with an explicitly selected blue background
JPG has no transparency. This example uses a blue background; PNG and WebP can preserve alpha.

Method: deterministic Canvas-generated 1200 × 800 sources, the production renderImage/compressToMaxBytes functions, quality 80 for format comparisons, and an automatic bounded search for byte targets. Resize examples export PNG. No measurements of network speed or field Core Web Vitals are implied.

Tools used in this guide

Continue reading