PNG to JPG

Every transparent pixel has to become a colour. Pick which one.

The file stays in this tab. Nothing is sent.

Drop a PNG.

Pick the colour that replaces the transparent parts. Save the JPG. Paste works too.

No file to hand?

One edge of a cut-out mark, at 400%

The PNGPart-covered pixels along the edge, over nothing at all.
Flattened as it isThe rim: colour borrowed from the old background, kept.
Edge repaired firstThe same pixels, taking their colour from the artwork.
Every converter produces the middle panel. This one measures the fault, names which of the two kinds it is, and shows you the third panel on your own file at the same magnification before anything is saved. The cells are drawn to explain the fault, not measured from a run.

Three questions, answered on your file

A converter that only asks for a file has decided all three of these for you and mentioned none of them. Here they are in the order the tool puts them, with what each one is measured against.

What colour do the transparent pixels become?
Four grounds, pressed rather than typed: white, the page colour, the colour recovered from the part-covered pixels themselves, and one you type. The picture changes under your finger at preview size, using the arithmetic the export runs at full size. White, held in place is the same converter with that decision already made.
coverage × colour + matte × (1 − coverage), per channel
Is the edge carrying a colour it should not?
Pixels between three and ninety-seven per cent covered are the only place the matte reads as anything. When they carry the colour of whatever the artwork was cut out of, flattening leaves a rim. The band is measured, the fault is named, and the repair borrows from the nearest solid pixel before the matte goes under it. Transparent PNG to JPG opens with the swatch row out and the repair already on.
3% – 97% coverage, inspected at 400%
Should this be a JPG at all?
The JPG is encoded at full size before the question is answered, so the figure compared against the source is the size of the file that would be saved rather than a prediction. If it comes out no smaller, the verdict says keep the PNG, above the export button, with the button still enabled.
output ≥ source, or within 15% on a sharp image

What happens to the transparent parts

JPEG has no alpha channel. A PNG can hold a pixel that is half there; a JPG holds pixels that are there. So every transparent and every part-transparent pixel has to be given an opaque colour, and something has to choose it. Most converters choose without mentioning it. Usually white. Sometimes black, and that is where the black square comes from.

The arithmetic is one line, per channel: the stored colour multiplied by its coverage, plus the matte multiplied by what is left over. On a solid pixel the coverage is one and nothing moves. On the band of part-covered pixels that anti-aliasing leaves along every curve and every letter, the matte shows through in proportion. That band is a pixel or two wide. It is also the only place the choice reads as anything other than a background.

Which is why a mark cut out of a dark panel goes wrong on white. Its part-covered pixels carry the panel's colour, not the mark's, and over white they read as a dirty rim around the shape. Nothing is broken: the file is correct and so is the arithmetic. The repair is to replace the colour in that band with a borrow from the nearest solid pixel, weighted by how little coverage the pixel has, and then run the matte under it.

Converting one file

  1. 1Drop the PNG, or paste it. The file's own first bytes decide what it is; the name is not consulted.
  2. 2Press a swatch. The stage splits along the diagonal: the PNG over its chequer upper-left, the JPG lower-right. Drag the diamond, or use the arrow keys, to walk the cut across an edge; press 1:1 to see it at actual pixels.
  3. 3Leave quality at 86 or move it, or give a kilobyte cap instead. The figure on the button is the size of the file that will be written, measured, not predicted.
  4. 4Press Save JPG. The file goes to your downloads folder from this tab.

Cases where a PNG should stay a PNG

A screenshot of a form is flat colour, hard type and a short palette. PNG stores that with a run-length pass over rows that mostly repeat, and it stores it exactly. JPEG has to describe every one of those hard edges with frequency coefficients, and hard edges need the high ones, which are the first thing quantisation rounds off. The file often comes out larger and the type always comes out softer.

So the tool encodes the JPG first, at full size, and then compares. If the result is not smaller it says so above the button, with the button still working. The comparison is the real file against the real file. An estimate accurate to within fifteen percent is not accurate enough to print beside a byte count and tell somebody to act on it.

The second case has nothing to do with size. If a third of the image is transparent, the transparency is probably doing a job — a logo that has to sit on other people's backgrounds, an icon that goes on a dark bar next week. Converting it spends that, and the colour you choose today is the colour it has from then on.

Things this tool refuses to do

It cannot ask for full-resolution colour.

The canvas encoder in your browser accepts a type and a quality; there is no third argument, so chroma subsampling cannot be requested. What the tool does instead is read the sampling factors back out of the file that was written and print those, and offer to try higher qualities to see whether any comes back at 4:4:4.

  • It takes PNG. One input format, one output format. That is the whole intake.
  • It carries no metadata from the PNG into the JPG. Not the orientation it applied, not the text chunks, not a copyright field. Some browsers' encoders add a standard sRGB colour label of their own, and that is all.
  • It converts the first frame of an animated PNG and drops the rest. It says which before the export, not after.
  • It does not produce transparency, only remove it, and it does not put a photograph behind a cut-out subject. A matte is a flat fill under the whole frame.

What people ask about the transparent bit

Why did my PNG turn black?
Because the converter put black under the transparent pixels and did not say so. JPEG cannot store transparency, so a colour has to go there. Some tools default to black, some leave the buffer uninitialised, which comes out black as well. Here the colour is a swatch you press, and white is only where the row starts.
Does the transparency come back if I convert the JPG to a PNG again?
No. The alpha channel is not compressed away, it is spent. Once a transparent pixel has been given a colour, the file holds an ordinary opaque pixel of that colour and nothing distinguishes it from a pixel that was always that colour. Keep the PNG if you might need the transparency later.
Why is there a grey outline around my logo?
The artwork was cut out against a different background from the one you are putting it on. Its part-covered edge pixels still carry the old colour. Turn on the edge repair: those pixels take their colour from the nearest solid pixel instead, and then the matte goes under them cleanly.
Still too big for the form
Open Quality and choose Fit under a size, then type the cap in kilobytes. The tool encodes the JPG at full size several times and keeps the highest quality that lands at or under the cap. If even quality 1 is over, the page says so with the figure; make the picture smaller under Size and it searches again.
Is the JPG the same dimensions as the PNG?
Yes, unless you set a size under Size — a long edge in pixels or a percentage, never larger than the PNG — or the file was over the working limit and you agreed to a lighter copy. Either way the output dimensions are printed before you save. JPEG itself stops at 65,535 pixels on a side; past that the format is the limit, not this page.
What happens to the metadata?
The JPG carries nothing from the PNG; some browsers' encoders add only a standard sRGB colour label of their own. An eXIf chunk is read for its orientation value, the rotation is applied, and then the chunk goes with everything else in it. If the PNG held a location, it does not survive the conversion. That is a fact about this tool rather than a feature of it.

Other pages here