On a typical page, images account for more transferred data than everything else combined. That makes them the first place to look for a speed improvement, and the available savings are usually enormous because the starting point is so often an untouched camera file.
Resize before you compress
This is the step that produces the largest saving and the one most often skipped. An image displayed at eight hundred pixels wide does not need to be four thousand pixels wide, and no compression setting recovers the waste of sending three times more pixels than will ever be shown.
Work out the largest size each image will actually be displayed at, then export at that size, or at double it for high density screens. A file resized appropriately and compressed moderately will be dramatically smaller than the original compressed aggressively.
Choose quality by eye
Lossy quality settings are not linear. The difference between maximum and eighty is usually invisible and can halve the file size. The difference between fifty and forty is often clearly visible for a much smaller saving.
Somewhere in the seventies or low eighties is a reasonable starting point for photographs. The right answer depends on the image, since fine detail and smooth gradients tolerate compression differently, so comparing versions side by side at full size is worth the minute it takes on any image that matters.
Strip the metadata
Camera files carry a great deal of embedded information: camera model, lens, exposure settings, editing history, sometimes an embedded thumbnail, and frequently GPS coordinates.
None of it is needed on the web and it can add a surprising amount to a file. The location data is also a genuine privacy concern, since publishing a photograph taken at home with coordinates intact is publishing your address. Most optimisation tools strip metadata by default, which is one reason to run files through one even when the compression saving is modest.
Use a modern format
With resizing and quality settled, format is the next lever. WebP typically produces files a quarter to a third smaller than an equivalent JPEG and is supported everywhere current. AVIF goes further at the cost of slower encoding.
The picture element lets you offer these with a fallback, so adopting them carries no risk. Vector graphics should be SVG, and running them through an optimiser to strip editor metadata often halves the size with no visual change at all.
Automate it
Doing this by hand does not survive contact with a real site. Anything that accepts uploads needs the processing to happen automatically, and even a static site benefits from a build step that generates the variants.
An image service or CDN that transforms images on request is the other common approach. You store one original, and the service produces resized, reformatted and compressed versions on demand, cached at the edge. It removes the whole problem from your workflow at the cost of a dependency.
Serve them from a CDN
A content delivery network holds copies of your files near your visitors, which reduces the round trip time considerably for anyone far from your server. For large files that distance is a significant part of the total load time.
Cache headers matter alongside this. Images rarely change, so they should be cached aggressively, with a fingerprint in the filename so that a new version is fetched when the content genuinely changes rather than relying on a short expiry.
Load the right things first
Optimisation is not only about size. Lazy load everything below the fold, load the main image eagerly, and consider a preload hint for the largest visible image so its download begins as early as possible.
Set width and height attributes throughout so no image causes a layout shift as it arrives. A page that loads quickly and then jumps around still feels broken.
Measure rather than assume
The network panel shows the size of every file and the total transferred, sorted by weight, which identifies the worst offenders in seconds. Lab tools give a score and specific recommendations.
Test on a throttled connection rather than a fast local one. A page that feels instant on a desktop connection can be genuinely painful on mobile data, and that is where a large share of visitors actually are.