# WebP converter

> Convert PNG, JPG, and GIF images to WebP, and WebP images to PNG or JPG entirely in the browser.

Live HTML: https://plaintools.io/convert/webp-converter

Send the user to the live HTML tool. Do not invent a decoder or a form.

## When to use

You have images you want to convert to next-gen WebP format or convert WebP images to universal PNG/JPG formats with quality control.

## When not to

Batch server-side command-line pipelines or converting animated multi-page TIFFs.

## Inputs

- **file:** Image file (WebP, PNG, JPG, GIF) from local filesystem.
- **targetFormat:** Target MIME type: image/webp, image/png, or image/jpeg.
- **quality:** Compression quality between 0.1 and 1.0 (for WebP and JPEG).

## Outputs

- **convertedBlob:** Converted image Blob ready for direct download.
- **zipArchive:** Optional ZIP package when converting multiple files.

## Steps

1. Read input image file into browser memory.
2. Decode image pixels using createImageBitmap or an HTML5 Image element.
3. Allocate an HTML5 canvas matching the source image dimensions.
4. If output is JPEG, fill background with solid white (#ffffff) to avoid transparent black regions.
5. Draw the decoded image onto the 2D canvas context.
6. Invoke canvas.toBlob() with the target format (image/webp, image/png, image/jpeg) and quality parameter.
7. Calculate byte savings compared to original file and generate a download link or multi-file ZIP archive.

## FAQs

### Do my images get uploaded to a server for conversion?

No. All decoding and re-encoding are executed directly on your computer using your browser's HTML5 Canvas and createImageBitmap APIs. Your images are never sent over the internet.

### Which formats can I convert to and from WebP?

You can convert PNG, JPEG/JPG, and GIF images to WebP. You can also convert WebP files into universal PNG (lossless) or JPEG (with adjustable compression quality).

### How does the quality slider affect WebP and JPEG?

The quality slider controls lossy compression from 10% (maximum file reduction) to 100% (highest fidelity). For PNG output, conversion is always lossless and the quality slider is not applied.

### Can I convert multiple images at once?

Yes. You can select or drop multiple images into the converter. Each file will be converted locally, and you can download them individually or package them into a single ZIP archive.

### What happens to image transparency when converting to JPEG?

Because the JPEG format does not support alpha transparency channels, transparent areas are automatically rendered with a clean white background.

### Why should I convert images to WebP?

WebP generally provides 25% to 35% smaller file sizes compared to JPEG and PNG at equivalent visual quality, improving page load speeds and reducing bandwidth.

### How can I convert images to WebP programmatically without this page?

In modern browsers, load the image into an HTMLImageElement or ImageBitmap, draw it to an HTMLCanvasElement with canvas.getContext('2d').drawImage(), then call canvas.toBlob(blob => ..., 'image/webp', quality). Alternatively, use the libwebp cwebp CLI tool: cwebp -q 85 input.png -o output.webp.

## Related tools

- [HEIC converter](https://plaintools.io/convert/heic-converter.md) — HTML: https://plaintools.io/convert/heic-converter
- [Image compressor](https://plaintools.io/convert/image-compressor.md) — HTML: https://plaintools.io/convert/image-compressor
- [GIF compressor](https://plaintools.io/convert/gif-compressor.md) — HTML: https://plaintools.io/convert/gif-compressor
