JPG, PNG, WebP, AVIF and HEIC compared

Last updated: 2026-10-11 · Checked and published by Leo, who runs Hanji

How each image format compresses, which support transparency and animation, measured file sizes on the same photos, and which format to use when.

Five image formats cover almost everything you will meet: JPG, PNG, WebP, AVIF and HEIC. They differ in how they shrink an image, what extra features they carry and, most practically, who can open them. This guide explains the differences, shows measured sizes for the same pictures saved in each format, and ends with a table of which format to use for what.

How each format compresses

Every format starts with the same thing: a grid of pixels. What differs is how that grid is stored.

JPG (JPEG), from 1992, splits the image into 8×8 pixel blocks and describes each block as a mix of smooth patterns. Fine detail the eye barely notices is rounded away, and colour is usually stored at lower resolution than brightness, because our eyes are less sensitive to colour detail. This is lossy compression: what is rounded away is gone. It works very well for photos and badly for sharp edges. Text in a JPG gets faint smudges around the letters.

PNG is lossless. It predicts each pixel from its neighbours and stores only the difference, then packs the result with the same kind of compression as a zip file. Large areas of flat colour and repeated patterns, as in screenshots, logos and diagrams, compress extremely well. Photos do not, because neighbouring pixels in a photo are rarely the same.

WebP, from Google, has two modes. Lossy WebP uses the still-image part of the VP8 video codec: it predicts blocks from the ones already decoded and stores only the correction, which beats JPG at the same visual quality. Lossless WebP is a separate mode that competes with PNG.

AVIF stores a still image using the AV1 video codec. It uses more flexible block sizes and better prediction than WebP, and generally compresses further still, especially at low file sizes. It also handles HDR and wide colour.

HEIC is the same idea using the HEVC (H.265) video codec, and is what iPhones save by default. It compresses far better than JPG, but HEVC needs patent licences, which is the main reason support outside Apple is patchy. The HEIC guide covers it in detail.

The newer formats are better mostly because they borrowed the much more advanced tools developed for video.

Transparency, animation and compatibility

JPG PNG WebP AVIF HEIC
Compression Lossy Lossless Lossy or lossless Lossy (lossless possible) Lossy
Transparency No Yes Yes Yes Possible, not used by iPhone photos
Animation No APNG variant Yes Yes Image sequences
Opens in all browsers Yes Yes Yes (current versions) Yes (current versions) Safari only
Opens in Windows, Office, most forms Yes Yes Often not Rarely Rarely

Two practical notes on converting:

  • Transparency to JPG. JPG has no transparent pixels, so when you convert a transparent PNG or WebP to JPG with Hanji, the transparent areas are filled with white. A logo on a transparent background becomes a logo on white. If you need the transparency, convert to PNG or WebP instead.
  • Animation. Converting an animated WebP or AVIF in the browser keeps only the first frame. Hanji’s converters produce still images.

Hanji can read all five formats but can write only JPG, PNG and WebP, because browsers have no built-in AVIF or HEIC encoder. If your browser cannot write WebP, the tool reports an error instead of quietly giving you a different format.

Measured sizes on the same pictures

These are real results from Hanji’s Image Converter, at quality 90 where the format is lossy, with the pixel size unchanged. The photos are 12 MP (4032×3024) iPhone JPGs; the screenshot is a 1280×900 PNG of a web page.

Input Saved as JPG Saved as PNG Saved as WebP
Portrait photo, 1.62 MB JPG 1.62 MB 14.3 MB 0.92 MB
Street photo, 4.28 MB JPG 2.81 MB 21.1 MB 2.14 MB
Beach photo, 6.25 MB JPG 4.10 MB 25.2 MB 3.46 MB
HEIC sample 1280×854, 718 KB 428 KB 2.30 MB 380 KB
Screenshot, 268 KB PNG 118 KB 635 KB 71 KB

What this shows:

  • WebP was 16–43% smaller than JPG at the same quality setting on the three photos, 11% smaller on the HEIC sample and 40% smaller on the screenshot.
  • Photos as PNG were 6–9 times bigger than the same photo as JPG, with no visible improvement.
  • The screenshot got smaller as JPG and smaller still as WebP, but both are lossy and leave faint artifacts around text. Re-saving it as PNG in the browser gave 635 KB, more than the original 268 KB, because the original had been saved by a program that optimises PNG files harder than a browser does.

The same pattern holds when you compress to a fixed size. With a 100 KB budget, the portrait could keep 2212 pixels of width as WebP but only 1340 as JPG. The upload size limits guide has the full table.

AVIF and HEIC are not in the table because the browser cannot save them. They usually come out smaller than WebP for the same quality, which is why they are used where the encoder is available: phone cameras and websites that prepare images in advance.

Which format to use

You want to… Use Why
Upload to a form, attach to email, put in a document JPG Accepted everywhere
Share a photo with someone on Windows or Android JPG HEIC and AVIF may not open
Save a screenshot with text or code PNG Lossless keeps letters crisp
Keep a logo or graphic with a transparent background PNG, or WebP for the web JPG has no transparency
Put photos on your own website WebP (AVIF if your tools can make it) Smallest files, all current browsers
Edit an image several times before the final save PNG while editing, then JPG or WebP Avoids loss at each save
Print a photo JPG at 95% or higher, full size Universal and high quality
Store iPhone photos Keep HEIC originals Smaller files, keeps depth and HDR

For the common cases the image converter does it in one place: pick JPG to make a screenshot or graphic smaller and accepted by forms, or when a downloaded WebP or AVIF image will not open in your software; pick WebP for websites; pick PNG when you need to keep transparency.

Why converting back and forth loses quality

Lossy formats each round away detail in their own way. JPG rounds within its 8×8 blocks; WebP and AVIF use different block shapes and predictions. When you convert a JPG to WebP, the WebP encoder sees JPG’s rounding errors as real detail and tries to preserve them, while adding its own. Convert back to JPG and a third set of errors is added. Each step is small at high quality, but they accumulate, and the file does not even get much smaller, because the encoder spends bytes describing the previous format’s artifacts.

Converting to a lossless format does not help either. Converting a JPG to PNG stores the JPG’s pixels exactly, artifacts included. It stops further loss, but cannot bring anything back, and the file grows enormously.

Some rules that follow from this:

  • Convert from the original whenever you have it, not from a copy that has already been converted or compressed.
  • Do the lossy step once, at the end. If you are cropping, resizing and converting, do the edits first and save to the lossy format last.
  • Convert to PNG only for a reason: transparency, an editor that needs it, or an image of text and graphics. Not to “improve” a photo.
  • Keep the original file. The converted copy is for sending; the original is the one you can still go back to.

JPG to PNG makes sense when software insists on PNG, for example some design tools or a form that wants a lossless file, and when you plan to edit the image many times. WebP to JPG and AVIF to JPG are the usual way to make a web download usable, and one conversion at quality 90 costs very little.

Guides