What Is the Maximum Dimension of a WebP Image?
This article examines the maximum dimension limits for images stored in Google's WebP format, the technical specifications behind this boundary, and practical solutions when working with assets that exceed these limits.
The maximum pixel dimension supported for an image stored in the WebP format is 16,383 × 16,383 pixels. This restriction applies across both width and height, meaning neither side of a WebP image can legally exceed 16,383 pixels regardless of whether the file uses lossy or lossless compression.
Why the 16,383 Pixel Limit Exists
The dimension ceiling is a direct result of how WebP was designed and standardized:
- 14-Bit Bitstream Encoding: WebP is bitstream-compatible with the VP8 video codec standard. The VP8 container format allocates exactly 14 bits for storing the width and 14 bits for storing the height of an image frame.
- Binary Math: In unsigned binary representation, 14 bits yield values from 0 up to 16,383 (calculated as \(2^{14} - 1\)). Because the format specification does not allocate additional bits for dimensional headers, the maximum readable integer is strictly capped at 16,383.
WebP Compared to Other Formats
WebP’s 16,383-pixel ceiling is sufficient for modern websites, high-DPI responsive banners, and 4K or 8K digital displays. However, it is smaller than the maximum dimensions supported by several legacy and modern formats:
- JPEG: Supports dimensions up to 65,535 × 65,535 pixels.
- PNG: Supports dimensions up to 2,147,483,647 × 2,147,483,647 pixels.
- AVIF: Built on the AV1 container, supporting dimensions up to 2,147,483,647 × 2,147,483,647 pixels.
- TIFF: Generally limited only by file container size constraints (4 GB standard, 16 EB in BigTIFF).
How to Handle Oversized Assets
Attempting to encode an image wider or taller than 16,383 pixels
using cwebp or popular image-processing libraries (such as
Sharp, ImageMagick, or GDAL) will result in a format-level conversion
error.
- Downscale Before Conversion: If preserving the exact source resolution is not essential, scale the longest edge of the source image down to 16,383 pixels or fewer prior to encoding.
- Retain PNG or JPEG: For panoramic photography, cartography, satellite data, or print-ready composites requiring dimensions beyond 16,383 pixels, use formats like PNG or JPEG.
- Tile the Asset: For deep-zoom web applications (such as Leaflet or OpenLayers), slice the large image into a grid of smaller WebP tiles (e.g., 256 × 256 or 512 × 512 pixels) and render them via a coordinate-based viewport.