Image Format Comparison

Encode one image as PNG, JPEG 90, JPEG 70 and WebP 80 in your browser and compare the real byte sizes and visual quality side by side.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Image Format Comparison?

The Image Format Comparison encodes one image four ways, as lossless PNG, JPEG at quality 90, JPEG at quality 70 and WebP at quality 80, and shows the exact size of each next to the original file. A results table marks the smallest output and lists whether each format is lossless or lossy and whether it supports transparency and animation. A Visual Comparison tab lets you flip between the four encodes to judge quality, not just bytes.

You can test one of three samples (a photo, a graphic and a logo) or upload your own image. The sizes are real: they are the bytes your browser's encoder produced, measured from the output, not estimates or rules of thumb.

Only formats a browser canvas can export are measured. That rules out AVIF, JPEG XL, GIF and SVG, which are covered in the reference notes and the guide instead. If your browser cannot encode WebP (older Safari), that row says so instead of showing a fake number.

  • Real encodes of PNG, JPEG 90, JPEG 70 and WebP 80
  • Exact byte sizes and change versus the original file
  • Side-by-side visual comparison tabs
  • Detects browsers that cannot encode WebP
  • Runs in your browser; uploads are not sent anywhere
Read the guide: JPEG, PNG, WebP, AVIF and JPEG XL: What Each Image Format Is For

Updated

How to use the Image Format Comparison

  1. In Image Selection, choose Sample Photo, Sample Graphic or Sample Logo, or choose Upload Custom Image and click Choose Image.
  2. Check the Preview, then click Compare Image Formats.
  3. Read the Size Comparison Summary for the smallest output and the original file size.
  4. Use the Format Comparison Results table to compare size, change from the original, setting, lossless or lossy, transparency and animation.
  5. Open the Visual Comparison tabs (PNG, JPEG 90, JPEG 70, WebP 80) and look at edges, text and gradients in each.

Worked examples

Why PNG can come out larger than the original

Input

Sample Photo (a PNG file as served)

Output

PNG row may show "x% larger than the original"

The browser's PNG encoder uses default compression settings and writes full 32-bit RGBA, while the original may have been optimised with a palette or stronger compression. A lossless re-encode cannot add quality, only bytes.

Photo versus screenshot

Input

Upload a camera photo, then a screenshot of a code editor

Output

Photo: JPEG 70 or WebP 80 smallest. Screenshot: PNG often competitive or smallest

Camera noise defeats lossless compression, so lossy formats win on photos by a wide margin. Large flat areas and sharp text compress well losslessly and show halos when compressed lossily.

Background and insight

The four outputs show the two families of image compression. PNG (a W3C Recommendation since 1996) filters each row and then compresses it with DEFLATE, the same algorithm as zip. It is lossless, so the decoded pixels are identical to the input, and it does very well on flat colours and very badly on camera noise. JPEG (ITU T.81, 1992) converts to a luma and two chroma channels, usually halves the chroma resolution, splits the image into 8 x 8 blocks and quantises the DCT coefficients of each block. That throws away detail you are unlikely to notice in a photo and produces ringing around sharp edges in screenshots.

WebP's lossy mode predicts each block from its neighbours before transforming it, which is why it typically beats JPEG at the same visual quality on photos. It also supports alpha and animation, and has a separate lossless mode that this comparison does not use. AVIF, built on the AV1 video codec, generally compresses better again and supports HDR and wide gamut, and it displays in Chrome, Edge, Firefox and Safari 16 or later; but no mainstream browser exports it from a canvas. JPEG XL (ISO/IEC 18181) can losslessly repack an existing JPEG about 20% smaller, and displays in Safari 17 and later, while Chromium and Firefox support has been on and off, so check current support before relying on it.

Canvas encoders favour speed over size. Dedicated tools such as mozjpeg, cwebp with tuned settings and oxipng usually produce smaller files at the same quality, so treat these numbers as a fair comparison between formats rather than the best each format can do. Canvas also drops EXIF data and colour profiles, and JPEG has no alpha, so the tool flattens transparent areas onto white before the JPEG encodes.

Common use cases

  • Choosing a format for a new asset

    Upload the actual hero image or illustration and see which format gives the best size before committing to it.

  • Settling a PNG versus JPEG argument

    Show a teammate the real byte counts and visual differences for the screenshot in question.

  • Estimating WebP savings

    Test a representative image from your site to see whether switching a pipeline to WebP is worth the work.

  • Teaching lossy versus lossless

    Flip between the PNG and JPEG 70 tabs to show students exactly what quantisation does to edges and gradients.

Tips and limitations

  • Test with your own images. Results swing widely with content, and the samples are only a starting point.
  • Compare quality at 100% zoom in the Visual Comparison tabs; scaled-down previews hide artefacts.
  • JPEG rows always show "Transparency: No". Transparent areas were flattened to white for the encode, which is what happens in any JPEG export.
  • PNG shows "APNG" for animation because animated PNG is part of the current PNG specification; this comparison itself encodes still images only.
  • A dedicated optimiser will beat every number here. Use the comparison to choose a format, then optimise with the best encoder you have.

Sources and further reading

  1. RFC 2083: PNG (Portable Network Graphics) Specification Version 1.0, IETF. The 1996 PNG specification, also published by W3C
  2. T.81: Digital compression and coding of continuous-tone still images, International Telecommunication Union. The JPEG standard
  3. RFC 9649: WebP Image Format, IETF
  4. AV1 Image File Format (AVIF), Alliance for Open Media
  5. JPEG XL, JPEG committee. Overview of ISO/IEC 18181, including lossless JPEG recompression

Frequently asked questions

Which image format gives the smallest file size?

It depends on the image. For photos, WebP and then JPEG usually win by a large margin. For screenshots, diagrams and logos with flat colour, PNG is often smaller and always sharper. Upload your own image to get the answer for that file.

Is WebP better than JPEG?

For web delivery, usually yes: at similar visual quality WebP files are typically smaller, and WebP also supports transparency and animation. JPEG still wins on universal compatibility outside browsers, such as old desktop software, printers and some email clients.

Why is AVIF not in the image format comparison?

Browsers display AVIF, but none of the mainstream ones can export it from a canvas, which is how this tool encodes images. Measuring AVIF needs a separate encoder such as avifenc or Squoosh. The guide linked on this page covers AVIF support and trade-offs.

Should I use JPEG XL on my website?

Not as the only format yet. Safari 17 and later display JPEG XL, but support in Chrome and Firefox has changed several times, so check current browser data and serve it with a fallback in a picture element if you use it.

Why does re-saving a PNG make it bigger?

The original may have used a colour palette or heavier compression than the browser's encoder, which writes 32-bit RGBA with default settings. A lossless re-encode keeps every pixel but cannot shrink below what a stronger optimiser already achieved.

Are the file sizes in the comparison exact?

Yes. Each size is the decoded byte length of the data your browser actually produced for that format. The original size is the uploaded file, or for the samples, the file as downloaded from this site.

Is there an in-depth guide to the Image Format Comparison?

Yes. “JPEG, PNG, WebP, AVIF and JPEG XL: What Each Image Format Is For” covers the background, how it works, common pitfalls and worked examples. Read the full guide.