WebP Image Container
RIFF-based modern raster image container supporting lossy (`VP8 `), lossless (`VP8L`), and extended alpha/animated/EXIF (`VP8X`) bitstreams.
CDN optimization proxies frequently transcode JPEGs into WebP on the fly while keeping `.jpg` URLs—causing desktop tools that trust file extensions to fail until Magic Bytes (`RIFF....WEBP`) are checked.
Drop any .webp file (even 100 GB+) to inspect locally
Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded
.webp Magic Bytes & Header Offset Map
'RIFF' + 4-byte LE chunk size + 'WEBP' FourCC
| Byte Offset | Length | Data Type | Field Name | Engineering Description |
|---|---|---|---|---|
| 0x00 - 0x03 | 4 B | char[4] | riff_magic | ASCII 'RIFF' |
| 0x04 - 0x07 | 4 B | uint32_le | riff_size | File size minus 8 bytes |
| 0x08 - 0x0B | 4 B | char[4] | webp_fourcc | ASCII 'WEBP' |
| 0x0C - 0x0F | 4 B | char[4] | first_chunk | 'VP8 ', 'VP8L', or 'VP8X' |
.webp Security & Polyglot Risk Matrix
Keep libwebp patched (>= 1.3.2, post CVE-2023-4863 Huffman heap overflow) and check both 0x00=='RIFF' and 0x08=='WEBP'.
Read .webp Header & Metadata Without Heavy Dependencies
import struct, sys
with open(sys.argv[1], "rb") as f:
riff, size, webp, chunk = struct.unpack("<4sI4s4s", f.read(16))
assert riff == b"RIFF" and webp == b"WEBP"
print(f"WebP ({chunk.decode().strip()}), riff_size={size}B")Deterministic .webp Sample Files & Edge Cases
minimal-vp8x.webp
Real WebP encoded by libwebp via Pillow — RIFF/WEBP container with decodable VP8L/VP8 payload.
curl -fsSL https://fileformat.co/fixtures/v1/webp/minimal-vp8x.webp -o minimal-vp8x.webp \
&& echo "297ca327517d16217664fbb2ab4e878a676db57b3050a92b5ab929259266ffde minimal-vp8x.webp" | shasum -a 256 -cog-banner-1200x630.webp
Real 1200×630 lossy WebP from Pillow at quality 85 for OpenGraph-dimension checks.
curl -fsSL https://fileformat.co/fixtures/v1/webp/og-banner-1200x630.webp -o og-banner-1200x630.webp \
&& echo "1cf094696041edb5cd955bf546811c69b1e8cdd5092cdfd765300849e2ceee2d og-banner-1200x630.webp" | shasum -a 256 -ctruncated-riff.webp
WebP truncated inside the image payload — declared RIFF size exceeds available bytes, Pillow must raise.
curl -fsSL https://fileformat.co/fixtures/v1/webp/truncated-riff.webp -o truncated-riff.webp \
&& echo "6b6b3468c2e38c48255de9164388e169324215d8fe802e113b1b109f631deee3 truncated-riff.webp" | shasum -a 256 -cRelated Specifications & Alternatives
Royalty-free HDR & wide-gamut next-gen web image format wrapping AV1 keyframes inside an ISO Base Media (`ftyp`) container (`major_brand` = `avif` or `avis`).
Lossless CRC-checked chunked raster image format, heavily used in AI workflows (ComfyUI / Stable Diffusion) to store generation graphs and prompts inside `tEXt`/`iTXt` chunks.
Marker-segmented DCT lossy image format (`FF D8 FF ... FF D9`), where embedded APP1 EXIF TIFF headers carry camera rotation flags (`Orientation=6`) and GPS coordinates.