What Is WebP File Format?
WebP is a modern image format developed by Google, with the goal of helping websites deliver media content without slowing down their websites. Currently, 96% of web browsers fully support WebP, with an additional 2% offering partial support. This makes WebP one of the most broadly supported next-generation image formats.
The format supports both lossy and lossless compression, with distinct features such as an 8-bit Y’CbCr 4:2:0 format for lossy compression and an RGBA format for lossless compression. It also supports a maximum pixel dimension of 16,383 x 16,383 pixels, making it suitable for high-resolution applications.
As an open-source format, WebP is designed to be a superior replacement for older image formats like JPEG, PNG, and GIF. This innovative approach focuses on creating smaller, higher-quality images to make the web faster. For example, WebP lossless images are 26% smaller in size compared to PNGs, offering significant advantages in terms of web performance and bandwidth usage.
According to Google research, WebP images with lossless compression are 26% smaller than comparable PNGs and 25-34% smaller than JPEGs at the same SSIM quality index. Lossless WebP images also support transparency with a relatively low “cost” in terms of bytes added to the image.
WebP also has a lossy compression option. WebP with lossy compression results in file sizes 3 times smaller than comparable PNGs.
WebP images are easy to identify by their .WEBP
extension and can be opened in various ways. Dragging the file into a browser window or right-clicking to select a compatible application are simple methods for accessing them. Additionally, developers can verify if an image is in WebP format using browser tools like Chrome’s Inspect feature, detailed later in this article.
WebP supports animation with features like 24-bit color depth and an 8-bit alpha channel, ensuring vibrant and smooth results. Additionally, the format uses advanced keyframe technology, which helps maintain high quality in animations.
WebP is not only about compression and quality; it is also practical for viewing and editing. For instance, you can easily open WebP files by dragging them into a web browser window or right-clicking and selecting a compatible application. Tools like XnConvert (which supports batch conversions) or Ezgif (a free online converter) make it simple to convert images to or from WebP without requiring advanced skills. These practical features make WebP an excellent choice for both developers and non-technical users.
In this article:
WebP Image Technology
The webP container
WebP images are stored in a container format based on Resource Interchange File Format (RIFF). RIFF containers are very lightweight, with an overhead of only 20 bytes (while it is possible to add more metadata). The RIFF container can support images with a side length of up to 16,383 pixels.
The format is also bitstream-compatible with VP8, using 14 bits for width and height encoding, making it an efficient and compact solution for web images. The VP8L bitstream ensures proper representation of image dimensions and quality.
WebP is widely supported across various web browsers, including Chrome, Safari, Opera, Microsoft Edge, and Firefox. This extensive browser support helps in the seamless integration of WebP images across different platforms. However, it’s important to note that some older browser versions and Internet Explorer may not support WebP. Additionally, some graphic editing tools, such as Adobe Photoshop, don’t natively support WebP without plugins or workarounds, which may limit its use in certain workflows.
To determine whether an image is in WebP format, you can use Chrome’s Developer Tools. Right-click on the page containing the image, select “Inspect,” then go to the “Network” tab, reload the page, and find the image file you want to verify. In the “Headers” tab, look for a line stating content-type: image/webp
.
Beyond browser compatibility, graphic design programs like Adobe Photoshop might not natively support WebP files. However, plug-ins or alternative tools like GIMP can help overcome this limitation. For quick and efficient conversions, tools like Ezgif provide a user-friendly, browser-based interface, while XnConvert offers additional features such as batch processing, rotating, and adding watermarks, making it suitable for more complex workflows.
Beyond the basic use case of a file containing a single image, the WebP container also supports metadata in EXIF or XMP formats, transparency, and color profiles using the International Color Consortium (ICC) standard.
WebP lossy compression algorithm
WebP lossy compression is based on intra-frame coding developed for the VP8 video codec, originally developed and open-sourced by Google. It uses a block-based transformation scheme with eight bits of color depth.
WebP compression uses the concept of block prediction. Each block in an image is predicted based on the three blocks above it and one block to the left. Prediction occurs in one of four modes: horizontal, vertical, single color (DC), and TrueMotion. Blocks that can be accurately predicted are not stored by the format.
When blocks cannot be accurately predicted by the algorithm, they are compressed using one of two transformation techniques:
After this transformation, the content undergoes entropy encoding, a lossless compression scheme.
WebP lossless compression
WebP’s lossless compression is a newer algorithm that was developed by Jyrki Alakuijala, a Google engineer. It uses several compression techniques:
- Traditional techniques, including indexed colors, Huffman coding, and dictionary coding.
- Advanced techniques, including dedicated entropy codes for each color channel, and a color cache of recent colors.
Converter software
Google provided a command-line converter for WebP that runs on Linux, known as cwebp, and a decoding library, which is shared with the WebM format. Open source version converters are now available for Windows and other platforms.
For quick and easy format conversions, tools like Ezgif or XnConvert simplify workflows by allowing drag-and-drop functionality, batch conversions, and even options to add watermarks or rotate images.
Pro Tip!
Consider Cloudinary’s URL Transformations
Cloudinary allows you to easily transform your images on the fly to any required format without the need for coding skills. Simply upload your images to Cloudinary and deliver them in your desired format via URL.
WebP Pros and Cons
Advantages of the WebP format include:
- Improving website performance—the WebP format is lighter than JPEG and PNG, so a page with WebP images will load faster for users.
- Saving bandwidth—WebP frees up bandwidth and allows websites to offer a richer media experience.
- Improved search engine optimization (SEO)—as part of Google’s Core Web Vitals recommendations, it explicitly recommends using modern image formats like WebP.
- Higher image quality—with WebP there is no need to sacrifice image quality for faster loading.
- Support for additional image features—unlike some other formats, WebP has support for transparency and animation.
- Practical usability—WebP files can be easily opened in most browsers or converted using tools like Ezgif or XnConvert, catering to both technical and non-technical users.
- Efficient animation: WebP’s keyframe technology and animation capabilities make it a strong contender for multimedia-rich applications.
Disadvantages of the WebP format include:
- Primarily designed for the Internet and is less useful for viewing images offline.
- Older browsers, such as Edge 12-17 and Firefox 2-64, do not support WebP (see full compatibility table).
- Some editing software, like Adobe Photoshop, does not support WebP without additional plugins, which could be a limitation for designers.
- In some cases, WebP compression can slightly degrade image quality. This is important when working with high-resolution images that must be displayed at high fidelity.
- Limited support in some graphic editing software, requiring additional plug-ins or alternative tools for effective editing workflows.
WebP Alternatives
WebP vs PNG
PNG is a widely used image format. Like WebP, it supports transparency, which is an important element for web design. Transparency allows you to structure your images so they don’t conflict with each other while maintaining a consistent design framework.
Advantages of PNG:
PNG format holds several significant advantages, making it a frequently utilized option for images and graphics.
- High-Quality Transparency: PNG images can have alpha channel transparency for high-quality transparent backgrounds and overlays.
- Broad browser support: PNG images are compatible with almost all modern browsers and operating systems, making them reliable for web use.
- Excellent Editing Capabilities: PNG images can be edited and saved multiple times without dropping quality, thereby they are best suited for graphics and logos.
- Lossless Compression: PNG uses lossless compression, leading to no reduction in image quality despite file size reduction.
Disadvantages of PNG:
Despite its advantages, the PNG format also carries a few drawbacks that could limit its effectiveness for certain applications.
- Large File Size: PNG images have typically larger file sizes than other image formats, which can negatively influence website speed and increase bandwidth usage.
- Limited Compression: Even though PNG uses lossless compression, it doesn’t compress images as effectively as some other formats, which can lead to larger file sizes.
Limited Color Depth: PNG supports up to 24-bit color depth, which might be insufficient for some applications requiring more intricate color patterns.
The key advantages of WebP over PNG are:
- WebP provides 23% smaller file size than PNG with the same image quality.
- WebP supports animation, while PNG does not.
The main advantage of PNG over WebP is that it is supported by all browsers.
WebP vs. JPEG
JPEG is a format widely used on the Internet, initially released in 1992. It uses a lossy compression algorithm, allowing users to define the compression level as a percentage, finding a balance between quality and file size.
The key advantages of WebP over JPEG are:
- WebP provides file sizes that are 25-35% smaller than JPEG for the same level of quality, as measured by the Structural Similarity Index (SSIM).
- WebP supports animation, while JPEG does not.
Like PNG, the main advantage of JPEG is that it is more widely supported by browsers and devices.
Related content: Read our guide to JPEG optimization
WebP vs. AVIF
AVIF stands for the AV1 image file format, an open-source format for storing animated and still images. Released in 2019 by AOMedia, AVIF is an image version of the AV1 video format. It derives from video frames using the AV1 codec and has image size limitations—the default limit of AVIF is 8K (7,680 x 4,320 pixels). Still, users can exceed it using separately encoded tiles.
WebP has an image resolution hard limit of 16,383 x 16,383 pixels—while larger than the default AVIF limit, there’s no workaround like in AVIF. Neither format compares JPEG 2000 or PNG, which have limits of up to 5000 megapixels. WebP has more browser support than AVIF.
The WebP format intends to provide higher-quality images in comparable file size to JPEG. However, AVIF provides even greater compression while retaining image quality (for both lossy and lossless compression). WebP compression can have side effects like blockiness and color banding.
Browser-Sensitive WebP Conversion with Cloudinary
The main challenge with WebP is that it is not supported by all browsers and platforms. To offer WebP images on your website and get the benefits of lower image size and improved performance, you need to:
- Convert existing images to WebP
- Store both the original and the WebP version
- Implement code on your site that displays the WebP version to supporting browsers and a fallback, such as PNG or JPG, for other browsers
Cloudinary can help achieve this effortlessly with just one line of code! Here is how:
- Sign up for a free Cloudinary account
- Upload your existing images to Cloudinary’s cloud storage (you can do this via our web interface or through our SDKs)
- Add the image to your site using a special URL like this:
https://res.cloudinary.com/demo/image/upload/w_300,f_auto/nice_beach.jpg
- The f_auto parameter works the magic – even though the original file is JPG, on supported browsers, Cloudinary will automatically convert the file to WebP.
For users looking to explore alternative tools for WebP conversion, XnConvert supports advanced batch processing, and Ezgif offers a fast and user-friendly online option. These tools complement Cloudinary’s automated capabilities, providing flexible solutions for all needs.
That’s it! With one simple step, you can convert all your images to WebP for supported browsers, while continuing to serve traditional formats for unsupported browsers.
Cloudinary can do much more than format conversion – learn more about our Media Experience Cloud.