# PNG to JPEG Converter

> Converts a PNG to a baseline JPEG in your browser, at a quality you choose and with transparency painted onto a colour you choose. The PNG decoder and the JPEG encoder both run in this tab, so the same settings give the same file whichever browser you use, and nothing is sent anywhere.

Use it: https://tessalor.com/en/image/png-to-jpeg

This tool runs entirely in the browser. Nothing entered into it is uploaded.

## How it is done

1. Read the chosen file in this tab and check the eight-byte PNG signature, then walk the chunk chain for IHDR, PLTE, tRNS, IDAT and pHYs.
2. Decompress the concatenated IDAT chunks as one zlib stream, using the browser's own DecompressionStream rather than a bundled inflater.
3. Undo the per-row filter — None, Sub, Up, Average or Paeth — working down the image, because each row is predicted from the one above it and the pixel to its left.
4. Expand the samples to eight-bit RGBA, whatever the file's colour type and bit depth, reassembling the seven passes first if the PNG is interlaced.
5. Composite every pixel onto the chosen background colour using its alpha, so a transparent pixel becomes that colour rather than whatever was underneath it.
6. Convert to Y, Cb and Cr with the full-range BT.601 coefficients that JFIF specifies, and halve the resolution of the two colour planes with a box filter if 4:2:0 is in use.
7. Take the discrete cosine transform of each 8x8 block, divide by the Annex K quantisation table scaled for the chosen quality, and round.
8. Huffman-code the coefficients with the Annex K tables, stuffing a zero byte after every literal 0xFF, and write the JFIF marker segments around the result.

## Assumptions

- Transparency is flattened onto the chosen colour before anything else happens, and the blend is done in sRGB rather than in linear light. That is not physically correct — a half-transparent pixel comes out a few per cent darker than it should — but it is what a browser canvas and every image editor do, so the JPEG matches the PNG you were looking at.
- Quality is the scale from Annex K of the JPEG specification, not the browser's. The same number gives byte-for-byte the same file here in every browser, but it will not match "quality 82" in Photoshop or GIMP, because each of those starts from different tables.
- Below quality 90 the two colour channels are stored at half resolution in each direction. On a photograph this is invisible; on saturated text or thin coloured lines it shows as fringing, which is why the setting can be forced to 4:4:4.
- A 16-bit PNG is reduced to eight bits by keeping the high byte of each sample. JPEG is an eight-bit format, so the low byte has nowhere to go.
- Colour profiles are not carried across. An iCCP, gAMA or cHRM chunk in the PNG is ignored and the result is written as plain sRGB, so a wide-gamut image will come out looking flatter than the original.

## Inputs

| Name | Label | Type | Default | Range |
| --- | --- | --- | --- | --- |
| `source` | PNG file | file | chosen on your device | image/png, up to 32 MB |
| `quality` | Quality | integer | 82 | 1 to 100 |
| `background` | Colour behind transparency | text | #ffffff |  |
| `subsampling` | Chroma subsampling | select | auto |  |

## Outputs

- `jpegSize` — JPEG size (text), primary
- `pngSize` — PNG size (text)
- `saved` — Smaller by (percent)
- `dimensions` — Dimensions (text)
- `transparency` — Transparent pixels (text)

## Questions

### Is my PNG uploaded anywhere?

No. The PNG is read in this browser tab and both the decoding and the encoding happen in a worker on your own machine. There is no server to send it to, and the automated test for this page fails if any request leaves this site while a file is loaded.

### Why does my transparent background turn black in other converters?

Because JPEG has no alpha channel, so the transparency has to become some real colour, and most editors leave whatever was stored underneath the transparent pixels. That is usually zero, which is black. The colour values are still in the PNG — the alpha channel was the only thing hiding them. Setting the background here paints over them before anything is encoded.

### Why is my JPEG bigger than the PNG was?

Because PNG is very good at exactly what JPEG is bad at. Flat colour, sharp edges, screenshots and line art compress beautifully losslessly and badly with a cosine transform. If the "smaller by" figure comes out negative, the honest answer is that this image should stay a PNG. JPEG wins on photographs, and usually by a lot.

### What quality should I use?

Around 80 for anything going on a web page, and 60 if you are trying to clear an attachment limit. Above 90 the file grows quickly for a difference almost nobody can see, and above 95 it grows very quickly indeed. Below about 50 the eight-by-eight blocks start to become visible in smooth areas such as skies.

### Will this match "Save as JPEG" at the same quality in Photoshop?

No, and no two encoders do. Quality is not a number defined by the JPEG specification; it is a way of scaling the quantisation tables, and every encoder scales differently and starts from different tables. This one uses the scaling published in Annex K of the specification, which is the closest thing to a common reference, and it gives the same result every time on every browser.

### Does it handle 16-bit, palette or interlaced PNGs?

Yes, all of them. The decoder covers every colour type and bit depth the format allows — one, two, four, eight and sixteen bits, greyscale, truecolour, palette, and either of those with an alpha channel — plus Adam7 interlacing and all five row filters. A 16-bit file is reduced to eight bits, because JPEG has nowhere to put the rest.

## Sources

- [Portable Network Graphics (PNG) Specification (Third Edition)](https://www.w3.org/TR/png-3/) — W3C, applies to W3C Recommendation, 24 June 2025. Retrieved 2026-07-30.
- [Recommendation T.81: Information technology – Digital compression and coding of continuous-tone still images – Requirements and guidelines](https://www.w3.org/Graphics/JPEG/itu-t81.pdf) — ITU-T, applies to T.81 (09/92), identical to ISO/IEC 10918-1. Retrieved 2026-07-30.
- [Recommendation T.871: Information technology – Digital compression and coding of continuous-tone still images: JPEG File Interchange Format (JFIF)](https://www.itu.int/rec/T-REC-T.871) — ITU-T, applies to T.871 (05/11). Retrieved 2026-07-30.
- [RFC 1950: ZLIB Compressed Data Format Specification version 3.3](https://www.rfc-editor.org/info/rfc1950/) — IETF, applies to 1996. Retrieved 2026-07-30.

## Variants

- [Why does my PNG go black when I save it as a JPEG?](https://tessalor.com/en/image/png-to-jpeg/transparent-background)
- [How do I make a PNG small enough to email?](https://tessalor.com/en/image/png-to-jpeg/smaller-for-email)

---

Estimate, not advice. See https://tessalor.com/en/disclaimer.
Machine-readable catalogue: https://tessalor.com/api/tools.json
