AVIF has a reputation for being the smallest format on the web. Then you export one and it is larger than the JPG it replaced. There are five usual reasons, and only one of them means you did something wrong.
AVIF wins on detailed photographs. It loses, sometimes badly, on small images, flat graphics, screenshots, and anything with heavy film grain or noise. If your file is large, the first question is not "what did I do wrong" but "what kind of image is this".
Before changing any settings, check two things: the pixel dimensions, and whether the file is really an AVIF. A 6000 × 4000 photo saved at high quality is supposed to be a few megabytes — that is not a bug, it is a large image.
A measurement from our own test machine — Chrome 156 on macOS 26.6.2, Apple silicon — using a 480 × 320 AVIF of a gradient with text:
| File | Size | Note |
|---|---|---|
| Original AVIF | 145,560 bytes | Encoded at quality 0.92 |
| JPG at 92% | 16,858 bytes | ImageMagick 7.1.2-35 |
| JPG at 85% | 7,097 bytes | ImageMagick 7.1.2-35 |
The AVIF was eight times larger than the JPG it became. Nothing was wrong with the file: flat gradients and sharp text are exactly the content AVIF handles least well, and the encoder was asked for near-maximum quality. A detailed photograph shows the opposite result — which is why "AVIF is smaller" is only true for some images.
magick identify -verbose input.avif | head -40
That prints the format, dimensions, colour depth, file size and any embedded profiles. If ImageMagick is not installed, the browser converter shows dimensions and file size for each file you drop in, which is enough for a quick check.
Two red flags to look for: a file that claims to be AVIF but reports a different format, and a file with an ICC profile or EXIF block measured in hundreds of kilobytes. Both change the answer.
Compression works by finding repetition. A landscape with a smooth sky and a repeating texture compresses beautifully. A night photo at ISO 6400, a film-grain effect, or a detailed fabric pattern is mostly noise — and noise is the one thing no lossy codec can throw away without visible damage.
What to do: almost nothing. This is the correct behaviour. If the file must be smaller, reduce dimensions or quality, and accept the loss. Denoising before encoding helps more than any encoder flag, but it also removes the grain you may have wanted.
AVIF encoders use a quality scale where the top of the range is not "good", it is "nearly lossless". Exporting at 90–100 can produce a file several times larger than the same image at 60–70, with no visible improvement at normal viewing size.
With libavif's command-line encoder, quality and speed are separate dials:
avifenc -q 60 -s 6 input.png output.avif
-q is quality, -s is encoder speed on a 0–10 scale (higher is faster and slightly larger). A slow preset at the same quality produces a smaller file; a fast preset produces a bigger one. If your export tool exposes "speed" or "effort", that setting is part of the size story.
What to do: try quality 60 and compare side by side at 100% zoom. Most photos survive it; text and fine line art do not.
A phone photo can carry EXIF, GPS, an ICC profile, XMP, and sometimes a full-size JPEG preview inside the container. On a 400 KB image, 150 KB of metadata is not a rounding error.
What to do: strip what you do not need before publishing.
avifenc -q 60 --ignore-exif --ignore-xmp --ignore-icc input.png output.avif
Keep the ICC profile if colour accuracy matters — removing it can shift colours more than the size saving is worth. Strip GPS and camera data as a default; keep colour.
Every format carries fixed overhead: headers, box structure, colour information. For a 32 × 32 favicon or a 200 px thumbnail, that overhead can exceed the compressed pixel data. This is why a tiny PNG is often smaller than the same tiny AVIF — and why icon sets still ship as SVG or PNG.
What to do: below roughly 300 px on the long edge, compare formats instead of assuming. For icons and logos, SVG beats everything; for small UI assets, PNG is frequently the smaller file.
Three comparisons that mislead:
What to do: compare at matched visual quality. Export both, look at them side by side at 100%, and only then compare bytes.
| Scenario | Expected | Action |
|---|---|---|
| 6000 × 4000 camera photo, quality 90 | Several MB | Nothing — resize for the destination instead |
| Web hero image displayed at 1600 px wide | A few hundred KB | Resize to 1600 px, then encode |
| 32 × 32 icon | Under 2 KB in any format | Use SVG; AVIF overhead dominates |
| Screenshot of a document | Larger than JPG at high quality | Use PNG, or JPG at 85% |
| Grainy night photo | Larger than a clean photo | Accept, or denoise first |
Resize before you encode. Serving a 4000 px image in a 800 px slot wastes bandwidth in every format, and no codec setting compensates for it. Decide the display size, export at 1× and 2× that width, and let the browser pick. This single step usually saves more than switching formats.