JPG vs PNG vs WebP: which image format to use

How the three common image formats differ in compression, transparency and file size, and which to pick for photos, screenshots and scans.

Updated

Use JPG for photographs, PNG for screenshots, diagrams and anything needing a transparent background, and WebP when you want smaller files for the web and know the software at the other end supports it. The differences come down to how each format compresses the picture.

At a glance

JPG PNG WebP
Compression Lossy Lossless Lossy or lossless
Transparency No Yes Yes
Animation No Limited (APNG variant) Yes
Best for Photos Screenshots, line art, logos Web images of either kind

JPG and JPEG are the same format. The three-letter spelling comes from old file name limits.

Lossy and lossless

Lossy compression throws away detail the eye is less likely to notice, to make the file much smaller. The loss is permanent, and it adds up: every time a JPG is opened, edited and saved again, it is compressed again.

Lossless compression makes the file smaller without discarding anything. Open and save a PNG a hundred times and the pixels are identical.

JPG

JPG is designed for photographs and other images with smooth changes of tone. It does poorly with sharp edges: text and line art pick up a visible haze of artefacts around them. It has no transparency.

PNG

PNG keeps every pixel exactly. It is very efficient for images with flat areas of color, such as screenshots and diagrams, and it supports full transparency. A photograph saved as PNG is typically several times larger than the same photo as a good-quality JPG, with no visible gain.

WebP

WebP, developed by Google, has both a lossy mode and a lossless mode, and supports transparency and animation. At similar visual quality its files are generally smaller than JPG or PNG. All current major browsers display it. Support in older software, some email clients and some document tools is less certain, so convert to JPG or PNG when sending a file to someone whose software you do not know.

What conversion can and cannot do

  • JPG to PNG does not restore quality. It freezes the image as it is, artefacts included, in a larger file. It is still useful before repeated editing, to stop further loss.
  • PNG to JPG makes photos much smaller but removes transparency, usually filling it with white, and softens sharp edges.
  • To WebP usually shrinks either type.
  • Changing format never adds detail. Neither does scaling an image up.

For scans of documents

Black-and-white text pages keep crisp edges as PNG. Color pages and photos of documents are usually smaller as JPG. Either can then be placed in a PDF; see JPG to PDF and what a PDF is.