PNG vs JPG: which to use

Use JPG for photographs and PNG for screenshots, logos, diagrams and anything with a transparent background. PNG stores every pixel exactly, which makes photo files large. JPG discards detail the eye rarely notices and is much smaller. In our test the same 4000-pixel photos averaged 12.7 MB as PNG and 515 KB as JPG at quality 82.

PNG and JPG side by side

PNG compared with JPG.
PNGJPG
CompressionLosslessLossy
TransparencyYesNo
AnimationNoNo
Browser supportUniversally supported in every browser since the late 1990s.Universally supported. It's been there since the first browsers.
Kodak photo, 768×512, average sizemeasured626 KB62 KB
Photo 4000 px wide, average sizemeasured12.7 MB515 KB
Screenshot 2880×1800, average sizemeasured509 KB182 KB
Encode time, photo 4000 px widemeasured9.2 s121 ms
Decode time, photo 4000 px widemeasured116 ms93.8 ms

Measured rows: lossy formats at quality 82, which is the converter's default, in headless Chromium on one machine. Quality 82 is not the same visual quality in every format, and no quality metric was computed. Sizes are averages across each image set. Times are medians. PNG sizes are the source files. PNG times are for this site's PNG encoder, including its optimisation pass, and its decoder. Method and full results.

How the two formats compress

PNG is lossless. It looks for repetition, such as runs of the same colour, and stores that compactly, then reproduces the image exactly. This works very well on flat colour and badly on photographs, where almost no two neighbouring pixels are identical.

JPG is lossy. It splits the picture into small blocks and keeps less of the fine detail in each one. Photographs survive this well. Hard edges do not: text and thin lines pick up faint noise around them, and saving the same JPG again and again makes it worse each time.

What we measured

Photographs: 90% smaller as JPG than as PNG on the Kodak set, and 96% smaller on photos 4000 pixels wide.

Screenshots: 64% smaller as JPG, an average of 182 KB against 509 KB. The saving is smaller than for photos because PNG is already efficient on flat colour, and the JPG versions no longer have perfectly sharp text.

When to use PNG, and when to use JPG

Use PNG when

  • The image is a screenshot, diagram, chart or anything with text in it.
  • You need a transparent background.
  • You will keep editing the file and do not want quality to drop with each save.

Use JPG when

  • The image is a photograph.
  • The file has to be small, for email, upload limits or page speed.
  • It needs to open on any device or in any program without question.

Convert between them

These run in your browser. The file is not uploaded.

PNG vs JPG: common questions

PNG keeps the image exactly as it was. JPG does not. For a photo at a sensible quality setting the difference is hard to see. For text and line art it is visible.

Other format comparisons

Last updated