File types · Explainer

The WebP file (.webp)

A WebP file is an image format from Google that can be lossy like JPEG or lossless like PNG, with transparency and animation, usually in a smaller file. This guide explains what's inside one, how it compares with the formats it replaces, and has free sample WebP files to download for testing.

At a glance

Full name
WebP (the name isn't an abbreviation)
Extensions
.webp
MIME type
image/webp, registered with IANA through RFC 9649
Kind
Binary raster image in a RIFF container; lossy, lossless, or lossy with lossless alpha
Standard or owner
Created by Google; specified in RFC 9649 (IETF, November 2024)
First released
Announced by Google in 2010
Colours
8 bits per channel. Lossy: YUV with colour at half resolution (4:2:0). Lossless: full RGB. Both can have alpha
Max dimensions
16,383 × 16,383 pixels
Animation
Yes, with per-frame timing in milliseconds
Magic number
52 49 46 46 (RIFF), a 4-byte size, then 57 45 42 50 (WEBP)
Opens with
All current browsers; most current image viewers and editors

The basics

What is a WebP file?

WebP is an image format Google introduced in 2010 to make web pages lighter. One format covers what used to take three: lossy compression for photos (like JPEG), lossless compression for graphics and screenshots (like PNG), and animation (like GIF), all with optional transparency.

Its lossy mode is based on a single frame of the VP8 video codec, which Google acquired with On2 Technologies. The lossless mode, transparency and animation were added in the following years. In November 2024 the format was published as an IETF document, RFC 9649, which also registered the image/webp media type.

Most people meet WebP by accident: you save an image from a website and get a .webp file. Many sites send WebP to browsers that accept it because it's smaller than the JPEG or PNG it replaces, even when the address ends in .jpg. All current browsers show WebP, including Safari since version 14 (on macOS 11 Big Sur or later), but some older desktop apps still can't open it.

Anatomy

What's inside a WebP file

A WebP file is a RIFF container: a 12-byte header, then chunks, each with a 4-character name, a 4-byte size and its data. Unlike PNG, sizes are little-endian: the least significant byte comes first. Here are the first bytes of sample-lossy.webp and a map of its chunks.

sample-lossy.webp (hex and chunk map)
52 49 46 46  BA 96 00 00  57 45 42 50
56 50 38 58  0A 00 00 00  0C 00 00 00  AF 04 00  1F 03 00
56 50 38 20  AA 93 00 00  90 A2 02  9D 01 2A  B0 04  20 03 …

offset  chunk    size    contents
000000  RIFF    38,586   file size minus 8, then "WEBP"
00000C  VP8X        10   flags: Exif + XMP; canvas 1200 × 800
00001E  "VP8 "  37,802   lossy image data (one VP8 key frame)
0093D0  EXIF       208   Exif metadata (TIFF header "MM")
0094A8  "XMP "     529   XMP metadata (XML), plus 1 padding byte
                         end of file at 38,594 bytes
  1. 152 49 46 46 BA 96 00 00 57 45 42 50

    The RIFF header

    RIFF in ASCII, then the size of everything after these 8 bytes (BA 96 00 00 = 38,586), then WEBP. RIFF is the same container family as WAV and AVI files, which also start with RIFF; the WEBP at byte 8 is what identifies the image.

  2. 256 50 38 58 0A 00 00 00

    VP8X: the extended header

    VP8X with a 10-byte body. It's there because the file uses features beyond a bare image: here, metadata. A simple WebP with no metadata, transparency or animation skips it and starts straight with the image chunk.

  3. 30C

    Feature flags

    0C is binary 00001100: the Exif and XMP flags are set. Other bits mark an ICC colour profile, alpha and animation. They tell a reader what to expect before it gets there.

  4. 4AF 04 00 1F 03 00

    Canvas size

    Width and height in 3 bytes each, stored minus one: 0x04AF + 1 = 1200 and 0x031F + 1 = 800.

  5. 556 50 38 20 AA 93 00 00

    The image chunk: "VP8 "

    Lossy image data, 37,802 bytes. The name ends in a space: 20. Lossless images use VP8L instead, and animations wrap each frame in an ANMF chunk.

  6. 690 A2 02 9D 01 2A B0 04 20 03

    The VP8 frame header

    This is a key frame from the VP8 video codec, the format WebP's lossy mode comes from. 9D 01 2A is the VP8 start code, followed by the width (1200) and height (800) again. A lossy WebP is, in effect, a single frame of video.

  7. 7EXIF … 4D 4D 00 2A

    Exif metadata

    The same Exif tags a JPEG carries, starting directly with the TIFF header (MM means big-endian), without JPEG's Exif\0\0 prefix.

  8. 8"XMP "

    XMP metadata

    Adobe's XML metadata: here a title and a rights line pointing to this page. Its size is odd (529), so a zero byte follows: every chunk is padded to an even length.

Under the hood

How WebP stores an image

WebP has two completely different compression engines inside one container:

  • Lossy (VP8 ). The image is converted to brightness and colour (YUV), with colour stored at half the width and half the height (4:2:0). It's cut into blocks of 16 × 16 pixels; each block is predicted from the pixels already decoded above and to its left, and only the difference is transformed, quantised and compressed. Prediction is a big part of why WebP beats JPEG, which codes each 8 × 8 block largely on its own.
  • Lossless (VP8L). The pixels are transformed to make them more predictable (predicting each pixel from its neighbours, decorrelating red and blue from green, or switching to a palette when there are few colours), then compressed with back-references to repeated pixel runs and Huffman coding, close in spirit to PNG but with more tools.

Everything else lives in optional chunks around the image data:

ChunkWhat it holds
VP8XExtended header: feature flags and canvas size. Present whenever any chunk below is.
VP8 Lossy image data.
VP8LLossless image data, with or without alpha.
ALPHTransparency for a lossy image, usually compressed with the lossless method, so edges stay exact.
ANIMAnimation settings: background colour and loop count (0 = forever).
ANMFOne animation frame: its position, size, duration in milliseconds, blending and disposal, then its own image data.
ICCPAn ICC colour profile.
EXIF, XMP Metadata, the same kinds JPEG files carry.

Readers are expected to skip chunks they don't recognise, so the format can grow without breaking old decoders. That's also why a WebP can carry metadata no viewer ever shows.

Variants

Lossy, lossless and animated WebP

The extension is always .webp, so you can't tell the kind from the name. The chunks give it away. Our samples, side by side:

SampleKindChunksSize
sample-lossy.webpLossy photo, 1200 × 800VP8X, VP8 , EXIF, XMP 38,594 bytes
sample-lossy-alpha.webpLossy with lossless alpha, 640 × 400VP8X, ALPH, VP8 , XMP 19,672 bytes
sample-lossless-alpha.webpLossless with alpha, 640 × 400VP8X, VP8L, XMP 20,910 bytes
sample-animated.webpAnimated, lossless frames, 320 × 200VP8X, ANIM, 20 × ANMF, XMP 13,384 bytes

For the flat artwork in the two alpha samples, lossless costs only about 6% more than lossy. For photos the gap is far larger, which is why photos are usually saved lossy and graphics lossless.

Comparison

WebP vs JPG, PNG, GIF and AVIF

Google's studies found lossless WebP files 26% smaller than PNGs, and lossy WebP files about 25 to 35% smaller than JPEGs of similar quality. Results vary by image, but the direction holds. Our transparent artwork is 33,653 bytes as sample-transparent.png on the PNG page and 20,910 bytes as lossless WebP, with every visible pixel identical.

WebPJPGPNGGIFAVIF
LossyYesYesNoNoYes
LosslessYesRarely supportedYesUp to 256 coloursYes
TransparencyYesNoYesOn/off onlyYes
AnimationYesNoYes (APNG)YesYes
Bits per channel88Up to 16PaletteUp to 12
Max size16,383 px per side65,535 pxAbout 2 billion px65,535 pxDepends on the profile; larger images are split into a grid
SupportAll current browsersUniversalUniversalUniversalAll current browsers
  • Use WebP for images on your own website: photos lossy, graphics lossless.
  • Use JPG or PNG for files people will download, edit, print or open in older software.
  • Consider AVIF when you need the smallest photos and can afford slower encoding.

WebP's limits

No progressive loading, no images larger than 16,383 pixels on a side, 8 bits per channel only, and lossy mode always halves the colour resolution, which can blur fine red or blue text. Use lossless WebP or PNG for screenshots of text.

Troubleshooting

Why did my image save as .webp, and why won't it open?

Websites and image CDNs often check whether your browser accepts WebP (from its Accept request header) and send WebP if it does, whatever the address says. "Save image as" saves what was actually sent, so you get a .webp.

  • To view it, drag it into any browser window.
  • On Windows, if Photos won't open it, install Microsoft's free Webp Image Extensions from the Microsoft Store, which lets Photos and other Windows apps open WebP.
  • On a Mac, Preview and Quick Look open WebP on macOS 11 Big Sur and later.
  • To get a JPG or PNG instead, convert it (below), or look for a download button on the site, which often gives the original file.
  • A .webp that won't open anywhere may be animated (some viewers only handle stills) or cut off. Check that it starts with RIFF and that the size in bytes 4 to 7 plus 8 equals the file size.

How to

How to open, edit and convert a WebP file

  • Open it: any current browser, Windows Photos (with the extension above), macOS Preview, Android and iOS photo apps, GIMP, and recent versions of Photoshop and Affinity Photo.
  • Convert to PNG or JPG: in Preview, File > Export; with Google's tools, dwebp image.webp -o image.png; with ImageMagick, magick image.webp image.jpg; or in the browser with Squoosh.
  • Make a WebP: cwebp -q 80 photo.jpg -o photo.webp for lossy, cwebp -lossless graphic.png -o graphic.webp for lossless. gif2webp converts animated GIFs and img2webp builds an animation from frames.
  • Inspect or edit chunks: webpinfo image.webp lists the chunks; webpmux -info shows animation frames; webpmux -strip exif and -strip xmp remove metadata.

Converting a lossy WebP to PNG gives a bigger file, not a better picture: the detail lost in compression doesn't come back.

Security

Is WebP safe? The 2023 libwebp vulnerability

A WebP file can't run code. But images are decoded by complex code, and bugs in that code are a real attack route. In September 2023, a heap buffer overflow in libwebp, Google's WebP library, was found being exploited in the wild (CVE-2023-4863). A crafted lossless WebP could corrupt memory in any program that decoded it with an unpatched libwebp, and almost everything uses libwebp: Chrome, Firefox, Electron-based desktop apps, image tools and server libraries.

It was fixed in libwebp 1.3.2. Browsers updated within days; apps that bundle their own copy took longer.

  • Keep browsers and apps updated. That's the main protection for viewing images.
  • If you process uploads, keep image libraries current, decode in a separate process or container, and set limits on dimensions and file size.
  • Mind the metadata. EXIF and XMP chunks can carry GPS coordinates and camera details just as in a JPEG. Strip them with webpmux -strip exif before publishing.

Free downloads

Sample WebP files to download

Free sample WebP files covering lossy, lossless, transparency and animation, for testing uploads, decoders, converters and size limits. All were generated from code and decode in Pillow (libwebp) and ImageMagick.

sample-lossy.webp · 37.7 KBDownloadOpen
The sample file sample-lossy.webp

What's inside sample-lossy.webp

sample-lossy.webp is a 1200 × 800 photo-style image saved lossy at quality 80, with metadata. Run webpinfo on it, or open it in a hex editor, to see these parts.

  1. RIFF header

    RIFF, the size of the rest of the file (38,586 bytes), and WEBP.

  2. VP8X extended header

    Flags for Exif and XMP, no alpha, no animation, and a canvas of 1200 × 800. A lossy WebP without metadata wouldn't need this chunk.

  3. VP8 image data: 37,802 bytes

    98% of the file. The same synthetic landscape as sample-photo.jpg on our JPEG page, which is about three times the size there; that one is saved at a higher quality setting, so the two are not a like-for-like test.

  4. 4:2:0 colour

    Colour is stored at 600 × 400, half the size in each direction, as in every lossy WebP.

  5. EXIF chunk

    A description, software, artist (Ada Example, fictional) and a copyright line pointing to this page.

  6. XMP chunk

    The title and rights as XML, followed by a padding byte because the chunk has an odd size.

All sample WebP files

  • Lossy WebP photo

    sample-lossy.webp · 37.7 KB (38,594 bytes)

    A 1200 × 800 synthetic landscape, lossy at quality 80, in the extended format with EXIF and XMP chunks.

    • Checking a site, CMS or app accepts WebP uploads
    • Testing which metadata a pipeline keeps
  • Lossless WebP with transparency

    sample-lossless-alpha.webp · 20.4 KB (20,910 bytes)

    640 × 400 artwork with a soft shadow, translucent circles and an opacity ramp, stored losslessly (VP8L). Same visible pixels as sample-transparent.png on the PNG page.

    • Testing alpha on light and dark backgrounds
    • Comparing lossless WebP and PNG sizes
  • Lossy WebP with transparency

    sample-lossy-alpha.webp · 19.2 KB (19,672 bytes)

    The same artwork with lossy colour (VP8 ) and a separate, losslessly compressed ALPH chunk, so the transparency is exact while the colours are approximated.

    • Decoder tests for the ALPH chunk
    • Checking converters keep transparency from lossy WebPs
  • Animated WebP

    sample-animated.webp · 13.1 KB (13,384 bytes)

    The bouncing ball from our GIF samples: 20 lossless frames at 100 ms, looping forever. About half the size of the GIF version, in full colour.

    • Checking animation survives upload and resizing
    • Testing viewers that only handle still WebPs
  • 100 KB WebP file

    sample-100kb.webp · 100 KB (102,400 bytes)

    A 1600 × 1067 lossy image, padded with whitespace inside its XMP chunk to exactly 102,400 bytes.

    • Upload and size-limit tests at 100 KB
    • Image CDN and resizing tests

Ways to test with them

  • Upload acceptance: some forms check the extension or MIME type and still reject WebP. Try sample-lossy.webp and expect image/webp.
  • Animation: after processing sample-animated.webp, the ball should still bounce. Many thumbnailers keep only the first frame.
  • Transparency: convert sample-lossy-alpha.webp to PNG; the background should stay transparent, not turn black or white.
  • Size limits: sample-100kb.webp is exactly 102,400 bytes, so you can test a 100 KB limit at the boundary.
  • Metadata: check with exiftool whether the Exif and XMP text in sample-lossy.webp survives your pipeline.

Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.

Put it online

Have a WebP file? Give it a link.

Drop a WebP on 99helpers and it gets its own web address. Anyone who opens the link sees the image straight away in their browser, animated WebPs included, with nothing to download or convert.

Questions

WebP files, frequently asked

What is a WebP file?

An image format made by Google for the web. It can be lossy like JPEG or lossless like PNG, supports transparency and animation, and is usually smaller than either.

How do I open a WebP file?

Drag it into any browser. On Windows, Photos opens it (with Microsoft's free Webp Image Extensions if needed); on a Mac, Preview opens it on macOS 11 or later.

How do I convert WebP to JPG or PNG?

Open it in Preview and use File > Export, use an online converter like Squoosh, or run dwebp image.webp -o image.png or magick image.webp image.jpg.

Is WebP better than PNG and JPG?

For images on a website, usually yes: smaller files at the same quality. For files people will download, edit or open in older software, JPG and PNG are still safer.

Why do images save as WebP from websites?

The site sends WebP to browsers that accept it, because it loads faster. You get what the browser received, even if the address ends in .jpg.

Does WebP support transparency?

Yes, in both lossy and lossless files, with full 8-bit alpha, unlike JPEG (none) and GIF (on or off only).

Can WebP be animated?

Yes. An animated WebP holds frames with their own timing and can loop. It's usually much smaller than the same animation as a GIF, and plays in all current browsers.

What's the maximum size of a WebP image?

16,383 × 16,383 pixels. For anything larger, use PNG, JPEG or TIFF, or split the image into tiles.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.