Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including webp-image-support with all npm packages installed. Try it out:

var webpImageSupport = require("webp-image-support")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

webp-image-support v0.6.0

Test if a browser supports the WebP - optionally update indicated elements with a class to indicate if WebP support is present.

WebP Test


This plugin will detect if the browser supports the WebP format, resolving a Promise with true if WebP support is present, and false otherwise.



import { supportsWebp } from './webp-image-support';

(async () => {

    const supported = await supportsWebp();
    if(supported) {
        console.log(`This browser supports WebP images`);
    } else {
        console.log(`This browser does not support WebP images.`);


Submit issues, request features, check out the repo here:

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free