JPEG, WebP or AVIF: what the measurements actually say

Three images, three different answers

The reason this article exists: “AVIF is half the size of JPEG at the same quality” is repeated so often that it sounds like a constant. It is not. The three sample images below were all scaled to 1200px wide and compressed on one machine, by one method, to the same SSIM. AVIF’s saving against JPEG came out at 49.76% for the photo, 81.24% for the screenshot and 92.88% for the illustration — the illustration saves roughly 1.9× what the photo does. How much you save depends entirely on what is in the picture.

Test environment: Apple M1 Pro (6 performance + 2 efficiency cores), macOS 26.5.2; encoders cjpeg (libjpeg-turbo 3.1.0), cwebp 1.5.0, avifenc 1.3.0 (bundled aom 3.12.1); measured 14 September 2026. Timings in the three main tables are single-threaded, interleaved within one run, minimum of 15 executions per command. Two later tables come from separate measurement runs and say so where they appear.

Sample 1: photograph, 1200×675, scaled from the macOS wallpaper DefaultAerial.jpg — lake surface, gravel, distant hills, a large gradient sky. Detail-dense.

Format Encoder flags Size vs JPEG RGB-SSIM Encode time
JPEG cjpeg -quality 80 114,293 B — 0.941648 6.93 ms
WebP cwebp -q 78 79,784 B −30.19% 0.942556 85.52 ms
AVIF avifenc --speed 6 -q 52 57,419 B −49.76% 0.942596 566.84 ms

Sample 2: illustration, 1200×750, a flat landscape drawn with ImageMagick — solid sky, a few polygonal hills, a round sun. Large flat fills and hard edges throughout.

Format Encoder flags Size vs JPEG RGB-SSIM Encode time
JPEG cjpeg -quality 80 26,149 B — 0.989271 8.42 ms
WebP cwebp -q 37 4,746 B −81.85% 0.989283 52.68 ms
AVIF avifenc --speed 6 -q 24 1,863 B −92.88% 0.990518 120.93 ms

Sample 3: code screenshot, 1200×968, 38 lines of this repository’s src/lib/image.ts rendered in Menlo as an editor window — light background, dark monospace text, coloured line numbers and keywords.

Format Encoder flags Size vs JPEG RGB-SSIM Encode time
JPEG cjpeg -quality 80 86,269 B — 0.984073 10.09 ms
WebP cwebp -q 23 25,078 B −70.93% 0.984146 80.09 ms
AVIF avifenc --speed 6 -q 30 16,181 B −81.24% 0.986189 239.98 ms

The photograph is where AVIF’s advantage is smallest — and photographs are exactly where most “AVIF halves your bytes” claims take their sample. The dramatic case is the illustration: 26,149 B down to 1,863 B, a factor of 14.0, where WebP on the same image manages only 5.5. I did not run an experiment to confirm the cause; the usual explanation is that large flat fills are the worst possible content for JPEG’s 8×8 block DCT, which rings persistently along hard edges, whereas AV1’s intra prediction can blanket a solid region with one large block at almost no bitrate.

One inconsistency in those tables needs stating, because it works against AVIF. All three encoders use their own defaults apart from quality, and those defaults are not on the same footing: cjpeg defaults to 2x2,1x1,1x1 (4:2:0) at 8 bit, lossy WebP is 4:2:0 / 8 bit at the format level, while avifenc 1.3.0 encoding from PNG input defaults to YUV444 at 12 bit. It prints both lines in its own output every time, which makes them easy to scroll past. The AVIF column was therefore measured under a stricter chroma and bit-depth specification than the other two.

I re-aligned AVIF at --yuv 420 --depth 8 against the same SSIM targets, and the result contradicts the intuition that a lower specification must be smaller: the photo went from 57,419 B to 61,046 B (6.32% larger), the illustration from 1,863 B to 2,021 B (8.48% larger), and only the screenshot shrank, 16,181 B to 16,092 B (0.55%). Two of three got bigger. That comparison does slightly favour 444, and it should be said why: SSIM here is computed across all three RGB channels, so preserving chroma earns credit directly. What the default really costs is time — in one interleaved run, 420/8-bit was 17.5% faster on the photo, 28.6% on the illustration, 22.5% on the screenshot. So the main tables are hard on AVIF only in the timing column; the size column is not penalised. Practically: unless you write --yuv 420 --depth 8 explicitly, what you get from avifenc is the main-table row — you pay some extra time for fuller chroma, and in most situations that is fine to leave alone.

How “equivalent quality” was defined, and what I did not do

This is the easiest place to go wrong, so plainly: I did not run a blind visual test. “Equivalent” in those tables means an objective metric was aligned. The method: encode JPEG at cjpeg -quality 80 as the baseline and measure its SSIM against the original PNG; then binary-search WebP and AVIF for the lowest quality value whose SSIM is not below that baseline — the smallest file that is not worse than JPEG.

SSIM is computed with scikit-image 0.21.0 structural_similarity, using data_range=255, channel_axis=2, gaussian_weights=True, sigma=1.5, use_sample_covariance=False — the 11×11 Gaussian-window setup from the original Wang et al. paper. It is deliberately computed across all three RGB channels rather than luma only, because the three encoders treat chroma differently and a luma-only metric would simply not charge for chroma loss. AVIF output is decoded back to PNG with avifdec before comparison.

Two limits of this alignment must be stated. First, the search steps in integers, and avifenc’s quality does not map one-to-one onto quantiser: on the photo, -q 52 and -q 53 produce an identical byte count (57,419 B), as do -q 28 and -q 29 on the screenshot, so “lowest viable q” carries a one-to-two-step granularity error in places. Second, equal SSIM is not equal appearance. I cropped the same 560×120 region from all three screenshot outputs and looked at them at 200%: JPEG shows classic ringing along glyph edges, WebP is uniformly soft, AVIF puts a faint colour haze around characters. Three completely different failure modes, and SSIM scores them nearly the same. If your images are sensitive to one particular kind of degradation — a brand-colour logo that must not shift hue, say — this alignment is not sufficient and you need to look for yourself.

AVIF’s bill arrives on the CPU

Pull the timing columns out of those three tables. To encode one 1200px-wide image, AVIF costs 81.8× what JPEG costs on the photo, 14.4× on the illustration, 23.8× on the screenshot.

That understates it. Feed cjpeg a 1×1 input and the minimum time is still 3.83 ms — so more than half of the photo’s 6.93 ms is process startup, and the actual JPEG encoding is a little over 3 ms. In AVIF’s 566.84 ms the startup (6.17 ms) is noise. One more inconsistency to declare: cjpeg reads PPM while cwebp and avifenc read PNG, so the latter two pay for a PNG decode — I measured that by feeding cwebp the same image as PNG and as PPM, and it is 2.86 to 10.19 ms. Subtract startup and PNG decode from both and the photo row is still 3.10 ms against 550.48 ms. The gap only widens.

--speed deserves its own section, because it is the one knob on AVIF that genuinely does something. Below is the photo at a fixed -q 52, single-threaded, from fastest to slowest. This is a separate measurement run: speed 6 came out at 578.0 ms here against 566.84 ms in the table above, 2.0% higher. That much run-to-run variation is normal, so do not read the last digit when comparing across tables:

--speed Encode time Size RGB-SSIM
10 61.6 ms 58,081 B 0.930344
9 61.7 ms 58,081 B 0.930344
8 221.0 ms 163,322 B 0.966954
7 285.4 ms 53,992 B 0.935754
6 578.0 ms 57,419 B 0.942596
5 2400.1 ms 56,538 B 0.944933
4 3211.2 ms 56,323 B 0.944839
3 6280.8 ms 55,685 B 0.945355
2 10695.1 ms 56,958 B 0.947741
1 12905.4 ms 57,074 B 0.947913
0 27817.3 ms 57,010 B 0.948015

The rows worth memorising are the first and last: going from speed 6 to speed 0 multiplies encode time by 48.1 (578.0 ms → 27817.3 ms) and buys 0.71% fewer bytes and 0.0054 more SSIM. Nearly 28 seconds for one 1200px image, to save 409 bytes that no real deployment will notice. Speed 6 is avifenc 1.3.0’s default and is where almost everyone should stop.

Two anomalies in that table, reported as observed. Speed 9 and speed 10 produce byte-identical output, so those two settings appear to collapse to one configuration inside aom. And speed 8 produced 163,322 B — 2.84× the size at speed 6, with noticeably higher SSIM — which means it is on a different rate-control path and the same -q 52 is simply not the same quality target at that setting. Both reproduced across two independent runs, but I did not read aom’s source to establish why, so this is observation without explanation. Do not treat avifenc’s -q as a scale that is comparable across speed settings.

That timing curve decides where AVIF belongs

The thing most often overlooked when choosing a format is neither size nor compatibility, but which part of your pipeline that curve lands on.

Static assets processed ahead of time: use AVIF, almost without thinking. Build-time cost is paid once and every visitor benefits. On the numbers above, processing 1,000 such photos single-threaded takes AVIF 9.4 minutes against JPEG’s 7 seconds — and nine minutes is an acceptable price for a CI pipeline, especially since the work parallelises, caches, and only needs rerunning when an image actually changes.

Converting on upload, in the request path: AVIF generally should not be there. Turn on --jobs all and the photo drops from 566.84 ms to 151.80 ms — 3.73× from 8 cores, so parallel efficiency is poor — which sounds tolerable. But those 152 ms monopolise all 8 cores. The number to compare is single-core occupancy: 6.93 ms for JPEG against 566.84 ms for AVIF, an 81.8× difference in throughput on the same machine. With a dozen simultaneous uploads you either queue or make everyone wait seconds. The sensible shape is to emit JPEG or WebP immediately on upload and hand AVIF to an offline queue.

Intermediate formats, throwaway previews, anything that must return instantly: JPEG. The few dozen kilobytes saved on that path do not buy back the few hundred milliseconds spent.

Browser support: distrust any figure without a date

These numbers go stale faster than anything else in this article, so the source and method first. The data below comes from caniuse-lite 1.0.30001810 in this repository’s node_modules, walked on 14 September 2026 with a script that sums usage_global across every version marked fully supported (y). caniuse’s own coverage is under 100% — the browsers it tracks total 96.688% of usage, with the remainder being a long tail it has no data for.

First fully-supporting version per engine — AVIF: Chrome 85, Firefox 93, Safari 16.4 (16.1–16.3 marked partial), iOS Safari 16.0 (entry carries a note), Edge 121, Samsung Internet 14.0. WebP: Chrome 32, Firefox 65, Safari 16.0 (14–15 partial), iOS Safari 14.0, Edge 18, Samsung Internet 4.

One point most people guess wrong: Edge did not support AVIF until 121, despite having been Chromium-based since 79 — the feature was switched off in Edge for a long time. So “it’s Chromium, therefore it supports it” does not hold for AVIF. You have to check the table.

And a caveat on the percentages: they are global traffic, and you never face global traffic. Corporate intranets, campus networks, government-procured devices, low-end Android in Southeast Asia — their version distributions can diverge wildly from that table. Your own access logs are the number that matters.

Transparency and animation: JPEG has neither

This is not a question of how well something is supported; it is a question of whether it exists. I ran a round-trip check: a 400×400 PNG with a filled circle in the centre and everything else transparent, encoded and decoded back, inspecting pixel (2,2) in the corner.

cwebp -quiet -q 80 alpha.png -o alpha.webp      # decodes back to (0, 0, 0, 0) — transparency kept
avifenc --speed 6 -q 60 alpha.png alpha.avif    # decodes back to (0, 0, 0, 0) — transparency kept

magick alpha.png -background white -flatten -strip alpha-flat.ppm
cjpeg -quality 80 -outfile alpha.jpg alpha-flat.ppm  # decodes back to (255, 255, 255, 255)

The extra -flatten on the JPEG path is not a shortcut I took: JPEG has no alpha channel at all, so transparent regions must be composited onto some background colour first. That step is not optional. Converting a transparent image to JPEG is not compressing it — it is making an irreversible background-colour decision on its behalf.

Animation is the same story. With a 4-frame 200×200 sequence, img2webp produced a 1,844-byte animated WebP, and avifenc --fps 10 f1.png f2.png f3.png f4.png anim.avif produced a 4,992-byte AVIF sequence (avifdec --info reports 4 frames, Repeat Count : Infinite). There is nothing on the JPEG side to test.

Progressive loading: here JPEG is ahead

Progressive JPEG splits the image into multiple scans by frequency, so a weak connection shows a blurry but complete image first and sharpens it pass by pass; baseline JPEG can only paint top to bottom. I cannot quantify the perceptual advantage on my own machine — it depends on network conditions and subjective judgement, and I am not going to pretend I measured it. But one thing is quantifiable, and the result runs against most people’s expectation:

Sample Baseline JPEG Progressive JPEG Size change Time change
Photo 114,293 B 108,835 B −4.78% 2.51×
Illustration 26,149 B 18,349 B −29.83% 1.59×
Screenshot 86,269 B 71,356 B −17.29% 1.86×

Progressive JPEG did not get bigger — all three got smaller, the illustration by nearly 30%. The cost is 1.6–2.5× the encode time, and JPEG encoding was only a few milliseconds to begin with. cjpeg -progressive is close to free; the only caveats are slightly higher decoder memory and very old software that may not read it.

Neither of the other two has an equivalent. WebP has no progressive mode — there is no progressive or interlace switch anywhere in cwebp 1.5.0’s options. AVIF has one, at a cost that makes it impractical: avifenc 1.3.0 marks --progressive EXPERIMENTAL in its help text, and on the photo it took the file from 57,419 B to 114,889 B — exactly 2.00× — with time going from 569.2 ms to 1763.1 ms (that pair was measured in one run whose ordinary encode was 569.2 ms rather than the first table’s 566.84 ms; run-to-run variation again). It works by encoding several layers, so doubling is a direct consequence of the structure. Whether browsers actually render it progressively I could not verify locally, so I draw no conclusion.

When JPEG is still the right answer

Set size aside and JPEG holds three positions nothing else will take soon.

Maximum compatibility. Not only browsers — mail clients, print workflows, elderly CMSes, image viewers baked into device firmware, third-party SDK avatar endpoints. Those update on timescales of years, and that 94.647% on caniuse says nothing about them. Any time an image leaves your page and enters someone else’s system, JPEG is the only format you do not have to ask about first.

Encode speed. Already worked out above: after subtracting startup and PNG decode, the photo costs JPEG 3.10 ms and AVIF 550.48 ms. These are different kinds of thing. Thumbnails, live previews, anything where the user expects to see a result the instant they finish uploading — that gap is the experience.

Images that downstream systems will re-process. Someone may crop, watermark, rescale or recompress. Lossy degradation accumulates in every format — but JPEG at least has jpegtran and friends, which rotate and crop losslessly without decode-and-re-encode. WebP and AVIF have far thinner tooling here.

One incidental finding, directly relevant to screenshots. On the screenshot sample I also tried cwebp -lossless: 21,058 bytes, SSIM exactly 1.000000, fully lossless. That is 16.03% smaller than the SSIM-aligned lossy WebP (25,078 B) and 75.59% smaller than JPEG’s 86,269 B. For screenshots, UI captures and flat illustration, trying lossless WebP first is an easily skipped option that frequently just wins outright — and it sidesteps the old problem of lossy compression smearing text edges. The image compressor on this site does comparable work in the browser if you want to compare quickly before committing to a batch job.

The <picture> fallback, written correctly

Browsers take the first type they recognise, so the order must run from smallest to largest — AVIF first, JPEG last as the backstop:

<picture>
  <source srcset="/img/hero.avif" type="image/avif">
  <source srcset="/img/hero.webp" type="image/webp">
  <img src="/img/hero.jpg" alt="Lake shore at sunset" width="1200" height="675"
       loading="lazy" decoding="async">
</picture>

Several details are not optional. alt, width and height belong on the <img> and have no effect on <source>; omitting the dimensions makes the page jump when the image finishes loading. Do not put loading="lazy" on an above-the-fold image — that delays the one load you most want started early. And <source> has no src attribute, only srcset.

With multi-resolution srcset, each <source> carries its own set:

<picture>
  <source type="image/avif"
          srcset="/img/hero-800.avif 800w, /img/hero-1600.avif 1600w"
          sizes="(max-width: 900px) 100vw, 900px">
  <source type="image/webp"
          srcset="/img/hero-800.webp 800w, /img/hero-1600.webp 1600w"
          sizes="(max-width: 900px) 100vw, 900px">
  <img src="/img/hero-800.jpg" alt="Lake shore at sunset" width="800" height="450">
</picture>

The last easily-missed point: <picture> only solves images in HTML. CSS background images, og:image, email templates and <link rel="preload"> all bypass it. og:image especially — it is fetched by social platforms’ and chat apps’ servers, not by browsers, and their AVIF support has nothing to do with that caniuse figure. JPEG is the low-stress choice there. If your images are generated server-side you can instead inspect the request’s Accept header and choose a format, but then you must send Vary: Accept, or a CDN will cache the AVIF and serve it to clients that cannot read it.

Image CompressorCompress JPEG, PNG and WebP images online. Batch processing, quality control and resizing — entirely in your browser, nothing uploaded.Open the tool →