Speed up your web page loading with WebP

Images are widely used

Images take more and more space in our bandwidth.
W3Techs statistic shows that 90% of all websites uses images.
For news.google.com, images count for 44 % of the assets loaded on the home page, taking 30% of the load time (source: I manually analyzed the page using DevTools).


Google proposed the WebP picture format, which provides smaller image size.
According to a case study conducted by Google themselves on different lossless compression algorithm vs webp, this last has shown up to 42% of saved bytes compared to the classic png compression library.
I have also tested against a JPEG image and here is what it gives:

As you can see, the JPEG image weights 530KB versus 195KB for the WebP image, which is 36% less heavy, not far from what Google states against PNG.


WebP is correctly supported across all the most popular browser (71% coverage at the moment).

Minimum version
Release date

Internet Explorer


Nov 13, 2018


Dec 05, 2018


Jan 29, 2019


Sep 25, 2018


source: https://caniuse.com/#feat=webp

Using WebP in production

Here is an example of optimization for web pages using HTML tag:
<!– before –>
<img src=”/img/mountain.jpg" alt="Moutains view" />

<!– after –>
<source type="image/webp" srcset="/img/mountain.webp" />
<img src="/img/mountain.jpg" alt="Mountains view" />

In case WebP is not supported by the user agent, the browser will fall back to the <img />.
The <picture> tag is so much more powerful. Learn more on the MDN page.

Tools for turning images into WebP format

There is plenty of services online to convert images to WebP. I personally automatize this task with Gulp.js.
const gulp = require("gulp");
const webp = require("gulp-webp");

gulp.task("webp", function() {
return gulp.src("src/img/**/*.{jpg,jpeg,png,svg}")

To go further

Let me recommand you this incredibly complete image optimization article by Boris.

Optimize Images to Reduce Page Weight: File Formats, Tools and RWD
Boris Schapira



Building or maintaining a website also comes with responsibilities towards our users: we should also consider the users on a light data plan.
I think web development is offering so much possibilites in term of optimizations. This is the perfect opportunity to improve engagement by reducing the user bandwidth usage, and in the same reducing your server i/o time.
That is why I think WebP might be a good ally when it comes to trimming those precious bytes without compromising the user experience.
Happy optimizations!
Cover photo by Pixabay from Pexels

Link: https://dev.to//khalyomede/speed-up-your-web-page-loading-with-webp-24bk