JPG, PNG, WebP or AVIF? How to Choose the Right Image Format
We encoded the same photos as JPG, WebP and AVIF at equal visual quality and compared the file sizes. Here is what each format is good at, when PNG is still the right choice, and how to convert your images.
Choosing an image format is a trade-off between file size, quality, transparency and compatibility. Pick the wrong one and you get a logo with a gray box around it, a screenshot five times larger than it needs to be, or a photo that an upload form refuses. This guide explains the four formats you will meet most often, shows what we measured, and ends with a simple decision rule.
The short answer
- Photos on a website: WebP, or AVIF if you want the smallest files and can produce them.
- Photos you email, upload to forms or print: JPG. Every device, app and print shop accepts it.
- Logos, icons, charts, screenshots with text, anything transparent: PNG or lossless WebP.
- Animations: animated WebP or a short video rather than a GIF.
How the four formats differ
| Format | Compression | Transparency | Best for | Support |
|---|---|---|---|---|
| JPG (JPEG) | Lossy | No | Photos, email, printing | Everywhere |
| PNG | Lossless | Yes | Graphics, screenshots, logos | Everywhere |
| WebP | Lossy or lossless | Yes | Photos and graphics on the web | All current major browsers |
| AVIF | Lossy or lossless | Yes | The smallest web photos | Chrome 85+, Firefox 93+, Safari 16.1+, Edge 121+ |
Lossy compression throws away detail the eye is unlikely to miss; the quality setting decides how much. Lossless compression restores every pixel exactly, which is ideal for sharp edges and text but makes photographs large. JPG cannot store transparency at all, which is why a logo saved as JPG always gets a solid background.
What we measured
To get real numbers rather than marketing claims, we used three copyright-free test photos (public domain or CC0) that ship with the scikit-image library: an astronaut portrait (512 × 512 pixels), a cup of coffee (600 × 400) and a cat (451 × 300), all stored losslessly. We encoded each one as JPG, WebP and AVIF with Pillow 12 (libjpeg-turbo, libwebp 1.6, libavif 1.4). For every format we searched for the lowest quality setting that still reached the same similarity to the original: an SSIM score of 0.97, which is very hard to tell apart from the original at normal viewing size.
| Photo | PNG (lossless) | JPG | WebP | AVIF |
|---|---|---|---|---|
| Astronaut, 512 × 512 | 425 kB | 39.5 kB (q74) | 30.0 kB (q80) | 22.9 kB (q58) |
| Coffee, 600 × 400 | 442 kB | 61.0 kB (q87) | 44.1 kB (q84) | 34.4 kB (q67) |
| Cat, 451 × 300 | 222 kB | 24.0 kB (q81) | 17.5 kB (q82) | 16.7 kB (q62) |
| Total | 1,088 kB | 124.4 kB | 91.7 kB | 74.0 kB |
At equal quality, the WebP files were 26% smaller than JPG in total (24–28% per photo), which is close to the 25–34% Google reports for WebP. AVIF saved 41% (30–44% per photo). Storing the photos as PNG would have needed almost nine times as much space as JPG: lossless compression is simply the wrong tool for photographs.
Screenshots behave differently
We also saved a 1280 × 900 screenshot of this website’s homepage, which is mostly flat color and text. As PNG it took 248 kB; lossless WebP cut that to 139 kB, 44% less, with every pixel unchanged. A JPG at quality 85 was smaller still (81 kB), but JPG compression leaves faint smudges around sharp text edges, and every further save adds more. For screenshots, start with lossless WebP or PNG.
JPG: the universal photo format
JPG has been the standard for photos since the early 1990s, and that is its biggest strength: every phone, computer, email program, upload form and print service handles it. Use it whenever you are not sure what the recipient can open.
Its weaknesses are just as clear. JPG has no transparency, and its compression works in blocks of 8 × 8 pixels, which become visible as blockiness at low quality. Every time you open, edit and save a JPG again, a little more detail is lost. Keep your original and export copies instead of re-saving the same file.
PNG: lossless and transparent
PNG stores every pixel exactly and supports full transparency, with 256 levels of opacity per pixel. That makes it the safest choice for logos, icons, diagrams and user-interface graphics that must look crisp on any background. Graphics with only a few colors also compress very well as PNG.
For photos, PNG is the wrong choice, as our table shows. And converting a JPG to PNG does not restore lost quality: PNG simply stores the already-compressed pixels without further loss, so the file only gets bigger.
WebP: the practical default for the web
Google introduced WebP in 2010. It supports lossy and lossless compression, transparency and animation in one format, and all current versions of Chrome, Edge, Firefox and Safari display it (Safari on macOS needs version 14 and macOS Big Sur or later). For most websites it is the best balance of size, quality and compatibility.
The catch is outside the browser: some older programs, online forms and print services still reject WebP. Keep a JPG or PNG version for those cases; our Image Converter (JPG, PNG, WebP) turns WebP back into either format in a few seconds.
AVIF: the smallest files, but slower to make
AVIF is based on the AV1 video codec; version 1.0 of the specification was released in 2019. It produced the smallest files in our test. Browser support is now broad, but it arrived later than WebP: Safari only added it in 2022 and Edge in 2024.
Encoding takes much longer. Saving the coffee photo took about 4 milliseconds as JPG, 75 as WebP (at the slowest, most efficient setting) and around 950 as AVIF at a medium speed setting on our test machine. For a single image that hardly matters; for thousands of images on a server it does. Browsers can display AVIF, but not all of them can create AVIF files from a web page, so our converter offers JPG, PNG and WebP, which every current browser can produce.
Pixel dimensions matter more than the format
The biggest savings usually come from resizing, not from the format. A 12-megapixel phone photo is 4000 × 3000 pixels. Shown in a blog column 800 pixels wide, it needs at most about 1600 × 1200 pixels to look sharp even on high-density screens. Resizing to that removes 84% of the pixels before any compression starts.
- Crop away what you don’t need with the Crop Image tool.
- Resize to the largest size the image will actually be shown at (about twice the display width for sharp results on high-density screens) with the Image Resizer.
- Convert to the right format with the Image Converter (JPG, PNG, WebP).
- Compress with the Image Compressor: start around quality 75 and compare with the original at 100% zoom.
- Keep the original. Every lossy save loses a little more detail.
A simple decision rule
- Does the image need a transparent background? Use PNG, or WebP for smaller files.
- Is it a photo for a website? Use WebP; use AVIF if your system can create it and you need every kilobyte.
- Is it a photo for email, a form, a print shop or an unknown recipient? Use JPG.
- Is it a screenshot, chart or logo? Use PNG or lossless WebP. If the logo exists as a vector file, SVG is even better on websites.
- Is it animated? Use animated WebP or a short video instead of GIF, which is limited to 256 colors.
Tools used in this guide
-
Image Converter (JPG, PNG, WebP)
Convert images between JPG, PNG and WebP right in your browser – for example PNG to JPG or JPG to PNG. Batch conversion, no upload.
Open tool -
Image Compressor
Compress JPG, PNG and WebP images in your browser. Choose the quality, shrink dimensions and download smaller files – no upload needed.
Open tool -
Image Resizer
Resize images to exact pixel dimensions or by percentage, with or without keeping the aspect ratio. Free, fast and private.
Open tool -
Crop Image
Crop JPG, PNG and WebP images online: drag a frame or enter exact pixels, with ratios like 1:1, 4:3 and 16:9. Free, no upload.
Open tool
Frequently asked questions
Does converting a JPG to PNG improve its quality?
No. The detail removed by JPG compression is gone for good. PNG stores the already-compressed pixels exactly, so the file only gets bigger.
Which image format is the smallest?
For photos at the same visual quality, AVIF was the smallest in our test (41% smaller than JPG in total), followed by WebP (26% smaller). For screenshots and graphics, lossless WebP is usually smaller than PNG.
Is WebP supported everywhere?
All current versions of Chrome, Edge, Firefox and Safari display WebP. Some older software, upload forms and print services still don’t accept it, so keep a JPG or PNG copy for those cases.
What quality setting should I use for JPG?
For photos on the web, 70–85 is a good range. In our test, JPG needed settings between 74 and 87 to look as close to the original as WebP at 80–84. The right value depends on the picture, so compare at 100% zoom.
Are my images uploaded when I use your tools?
No. Our image tools run in your browser. Your files are processed on your own device and never sent to our server.
Sources and further reading
- WebP: An image format for the Web – Google for Developers (developers.google.com)
- Image file type and format guide – MDN Web Docs (developer.mozilla.org)
- AVIF – Wikipedia (format history and browser support) (en.wikipedia.org)
- scikit-image test images (astronaut, coffee, chelsea) (scikit-image.org)