# PNG to JPG converter

> Convert PNG images to JPG format entirely in your browser with adjustable quality and background color.

Live HTML: https://plaintools.io/convert/png-to-jpg-converter

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

## When to use

You have PNG images and need smaller, web-ready JPG/JPEG files without uploading graphics to a remote server.

## When not to

When you require transparency (use PNG or WebP) or lossless pixel-perfect graphic archival.

## Inputs

- **file:** PNG image file (.png).
- **quality:** JPEG compression factor from 0.1 to 1.0 (default 0.85).
- **backgroundColor:** Hex background color (default #ffffff) to replace alpha transparency.

## Outputs

- **jpgBlob:** Converted JPEG image blob ready for direct download.
- **zipArchive:** Optional ZIP package when converting multiple PNG files.

## Steps

1. Read source PNG file into browser memory.
2. Decode image pixels using createImageBitmap or an HTML Image element.
3. Initialize an HTML5 canvas matching source image width and height.
4. Fill canvas background with chosen color (default #ffffff) so transparent areas do not become black.
5. Draw decoded PNG onto canvas context.
6. Call canvas.toBlob() with MIME 'image/jpeg' and chosen quality parameter.
7. Calculate file size savings and provide instant single download or bulk ZIP download.

## FAQs

### Does this PNG to JPG converter upload my images to a server?

No. All image decoding and re-encoding are performed locally inside your browser using the HTML5 Canvas API. Your pictures never leave your device and are never sent over the internet.

### How does this tool handle transparent backgrounds in PNGs?

The JPEG format does not support alpha transparency channels. When converting a transparent PNG, transparent pixels are automatically painted with your selected background color (white by default, with custom color support) so you never get unwanted black backgrounds.

### What does the JPEG quality slider do?

The slider adjusts the lossy compression level passed to canvas.toBlob() from 0.10 (10% quality, smallest file size) to 1.00 (100% quality, maximum visual fidelity). An 80% to 85% setting is generally optimal for web photos and documents.

### Can I convert multiple PNG files at the same time?

Yes. You can select or drag and drop multiple PNG files into the converter. You can then download converted JPGs individually or download the entire batch as a single ZIP archive.

### Why should I convert a PNG to a JPG?

PNGs use lossless compression, which can make photographs and complex illustrations very large. Converting to JPG significantly reduces file sizes (often by 70% to 90%), making pages load faster and reducing email attachment sizes.

### How do I convert PNG to JPG programmatically in JavaScript?

Load the PNG into an Image element or ImageBitmap, create an HTMLCanvasElement with matching dimensions, fill the context with a background color using fillRect(0, 0, width, height), draw the image with drawImage(), and call canvas.toBlob(blob => ..., 'image/jpeg', quality).

### Are there any file size or resolution limits?

The only limits are your device's memory and browser canvas size capabilities (most modern desktop and mobile browsers comfortably handle images up to 16,384 x 16,384 pixels).

## 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
- [WebP converter](https://plaintools.io/convert/webp-converter.md) — HTML: https://plaintools.io/convert/webp-converter
- [JPG to PNG converter](https://plaintools.io/convert/jpg-to-png-converter.md) — HTML: https://plaintools.io/convert/jpg-to-png-converter
