Cut image size in half, but retain quality

Reduce image file sizes by ~50% without significant quality loss, lower the climate footprint, and improve the user experience.

On a typical website, images make up around 60-80% of the data that needs to be transmitted over the Internet. We can significantly reduce the amount of data by adjusting the compression ratio or offering images in a modern format such as WebP

A lighter website loads faster – especially on mobile phones – and the reduction in file size translates directly into lower power consumption and CO2 emissions.


One photo, four compression settings

In the gallery below, you will see four versions of the same 2560×1440 pixels image, compressed at four different settings. Click on any of the images to zoom in. You can also browse the gallery using the left and right arrow keys.

Photos with fine detail and delicate colour transitions are difficult to compress without being apparent. In the example above, the difference is most noticeable on the trees in the centre of the image.

JPEG is good. WebP is better.

By default, WordPress compresses JPEG images to quality 82. By simply lowering this setting to 70, we can reduce the file size considerably without significant visual degradation. If we go a step further and convert the image to WebP format, we can achieve an additional reduction in file size

File formatFile size
JPEG-82440 KB
JPEG-70312 KB
WebP-82254 KB
WebP-80203 KB
File size compared to standard WordPress JPEG quality

Reduced file size compared to the original

Photos are different and that is reflected in how much they take up. Photos with a lot of detail take up more space than photos with a few. Test different compression ratios with your photos and choose a reasonable balance between file size and quality. Here you can see how little the windmill image takes up compared to the original in different qualities:

JPEG-quality 82

100%

JPEG-quality 70

71%

WebP-quality 82

57%

WebP-quality 80

46%

Many photos are decorative

Many photos are just used for illustration or decoration and are hopefully always scaled down to a size that fits the layout, and always compressed to some degree. If it is essential that a photo is available in full resolution, for example on a photography site like Unsplash, there is a dedicated download button for that purpose. A slightly higher level of compression or conversion to WebP is unlikely to be noticed by the visitor – it would only be because the site loads faster.

Can you use WebP?

Yes, you can, and you should. All modern browsers support WebP. To support very old browsers, you can apply a technique where the website checks in with the visitor’s browser, and if the browser doesn’t like WebP, it’s just served the original JPEG or PNG.

WebP is supported in all browsers with a browser share larger than 0.5%, according to Can I Use.
WebP is supported in all commonly used browsers according to caniuse.com

Webp Image format (based on the VP8 video format) that supports lossy and lossless compression, as well as animation and alpha transparency. WebP generally has better compression than JPEG, PNG and GIF and is designed to supersede them. AVIF and JPEG XL are designed to supersede WebP.

caniuse.com
Illustration of Bjarne at his desk at Codeally. Bjarne wears a cap, glasses, a beard and a big smile.

Bjarne Oldrup

Bjarne Oldrup is a web developer and freelancer at Codeally in Sønderborg. With a background as a data technician (1992) and decades of experience as a programmer, systems administrator and network specialist, he works to promote an open, accessible and respectful internet.

He helps SMEs build a healthy, secure and visible online presence. Bjarne’s work is founded on well‑grounded expertise in networking and internet protocols, combined with hands‑on experience in improving resource efficiency, enhancing web accessibility and safeguarding users’ privacy.

Bjarne co‑founded Sustainable Web and gives talks on digital transition. He is active in the open‑source community, primarily works with WordPress, HTML and CSS, and champions Mastodon and federated networks as routes to greater digital sovereignty.

Leave a Reply

Your email address will not be published. Required fields are marked *