AVIFify

Understand lossy vs lossless image compression, how each works, and which mode to pick for photos, line art, and masters — with AVIF numbers throughout.

What Lossy and Lossless Compression Actually Trade

Every image you save makes one choice: discard data you can never get back, or keep every bit. This guide explains both mechanisms, then maps each to the content type and format — including AVIF, which does both.

The one-line difference

Lossy compression deletes image data permanently; lossless compression rebuilds the original pixel-for-pixel.

After a lossy save, the decoded image is mathematically different from the source — close enough to fool the eye, but altered. After a lossless save, the decoded image is bit-identical to the source. That single distinction drives every recommendation below.

A useful test: re-save the same file ten times. A lossless file is identical on save ten as on save one. A lossy file degrades a little each pass — covered under generational loss.

How lossy codecs throw data away

Lossy codecs exploit the limits of human vision. They keep what you notice and discard what you don't. Three mechanisms do the work.

Transform coding (DCT and beyond)

The encoder splits the image into blocks — 8×8 pixels for JPEG — and converts each block from pixel values into frequency coefficients using a discrete cosine transform. Low frequencies describe smooth gradients; high frequencies describe fine edges and texture. AVIF uses AV1's transform set, which adds larger and directional transforms that suppress the blocking JPEG is known for.

Quantisation

Quantisation is where bytes actually disappear. The encoder divides each coefficient by a step size and rounds, zeroing many high-frequency coefficients outright. Quantisation is the irreversible step — the rounded-away detail cannot be recovered. The quality setting controls the step size: lower quality means coarser steps, smaller files, and more visible loss.

Chroma subsampling

The eye resolves brightness far better than colour. Lossy codecs store colour at reduced resolution to save space. The common 4:2:0 scheme keeps full-resolution luminance but stores the two colour channels at half resolution on each axis, cutting colour data by 75% with little perceived change on photos. AVIF can also encode 4:4:4 (full colour) when sharp coloured edges matter.

How lossless codecs keep everything

Lossless codecs reorganise data without deleting any. They find redundancy and describe it compactly, so the original reconstructs exactly. Typical techniques:

  • Prediction — describe each pixel as a small offset from neighbouring pixels, so flat regions encode as near-zero.
  • Entropy coding — assign short codes to common values (Huffman, arithmetic, or range coding).
  • Back-references — replace a repeated run of pixels with a pointer to its earlier occurrence (the LZ77 idea behind PNG's DEFLATE).

Because nothing is discarded, lossless files are larger than lossy ones for the same image — often several times larger for photographs, where there is little exact repetition to exploit.

Generational loss: the photocopy effect

Lossy formats degrade when re-encoded. Each lossy save re-runs transform, quantisation, and rounding, so detail erodes with every generation — like photocopying a photocopy. Open a JPEG, crop it, save as JPEG, repeat: artefacts accumulate visibly after a handful of passes.

Lossless formats have no generational loss. You can open and re-save a PNG a thousand times with zero degradation. Two practical consequences:

  • Keep your editing master in a lossless format (PNG, TIFF, or a RAW/PSD original), and export lossy only at the end.
  • Avoid re-encoding a JPEG as a high-loss AVIF repeatedly; encode once at a quality you are happy with.

For AVIF-specific quality numbers, see AVIF Compression Settings.

Which formats are lossy, lossless, or both

Format choice and mode choice are linked but not the same. Some formats only do one mode; modern ones do both.

FormatLossyLosslessNotes
JPEGYesNoDCT-based; the original lossy web format
PNGNoYesDEFLATE; ideal for flat colour and transparency
GIFNoYesLossless but capped at 256 colours
WebPYesYesSeparate VP8 (lossy) and VP8L (lossless) engines
AVIFYesYesAV1 intra-frame coding handles both modes

GIF is technically lossless, but its 256-colour palette throws away colour before compression even starts — so a photo saved as GIF still looks wrong. That is palette reduction, not lossy compression. See JPG vs PNG for the classic lossy-versus-lossless pairing.

AVIF does both — and how well

AVIF carries both a lossy and a lossless mode in one format, which is its core advantage over picking JPEG or PNG up front.

  • AVIF lossy stores a photograph in roughly half the bytes of a JPEG at matched visual quality, with the widest savings at low and medium bitrates. See AVIF vs JPG.
  • AVIF lossless is competitive with PNG on photographic content but can lose to PNG on flat art and simple graphics, where PNG's palette and run-length handling are already very efficient. For a flat-colour logo, AVIF and PNG often land within a few kilobytes of each other, and PNG sometimes wins. See AVIF vs PNG.

The takeaway: reach for AVIF lossy on photos, and test AVIF lossless against PNG case by case on graphics rather than assuming AVIF always wins.

When to choose each mode

Match the mode to the content, not the other way round.

Choose lossy for continuous-tone content

Photographs, AI-generated images, paintings, and 3D renders have smooth gradients and unlimited colours. They contain no exact repetition for lossless to exploit, so lossless bloats them with no visible benefit. Encode photos as lossy AVIF — typically 50% smaller than JPEG at the same quality.

Examples: hero photos, product shots, article images, generative art.

Choose lossless for crisp, structured content

Line art, logos, icons, UI screenshots, charts, diagrams, and any image with text have hard edges and flat fills. Lossy compression rings around edges and bands across fills. Encode these as lossless — PNG, or AVIF lossless tested against PNG.

Examples: brand marks, app icons, interface screenshots, code screenshots, vector exports.

Choose lossless for masters and archives

Editing masters and archival originals must survive repeated edits and re-exports without degrading. Keep masters lossless so generational loss never compounds, then export lossy derivatives for delivery.

Examples: design source files, scanned documents, photo libraries of record.

Visually-lossless targets

You rarely need true bit-perfect output for the web — you need visually lossless, meaning no difference a viewer can spot at normal viewing distance.

  • Hero and product photos: AVIF quality ~80–85 is visually lossless for most viewers.
  • Article and body images: AVIF quality ~70–75 holds up below the fold.
  • Thumbnails: AVIF quality ~60–65, since small render size hides aggressive compression.

Quality does not scale linearly: dropping from 100 to 90 loses almost nothing, while dropping from 50 to 40 loses a lot. Anchor settings to the upper end of the curve. More detail in AVIF Optimisation.

FAQ

Is AVIF lossy or lossless?

AVIF is both — one format with a lossy mode and a lossless mode. Pick the mode per image based on content type.

Does lossless mean no compression?

No — lossless still shrinks files, just without discarding data. PNG often halves an uncompressed bitmap while staying pixel-perfect.

Will converting a JPEG to AVIF lose quality?

Slightly, if you re-encode lossy — the JPEG already took one lossy pass, so encode AVIF at quality ~80 or higher to avoid visible compounding. See JPG to AVIF.

Is AVIF lossless always smaller than PNG?

No — AVIF lossless competes with PNG on photos but can be larger than PNG on flat art and simple logos. Test both. See AVIF to PNG.

Which is better for a logo, lossy or lossless?

Lossless — logos have hard edges and flat fills that lossy compression visibly damages with ringing and banding.

Keep going

Sources

Image SEO in 2026: Alt Text, Page Speed, and AVIF

Image SEO for 2026. Which signals move rankings, which are myths, and how AVIF's smaller files feed the page-experience signals Google measures.

Getting Started: Convert Your First Image to AVIF

A short guide to converting your first image to AVIF with AVIFify. Drag, drop, and download — no signup, no upload.

Core Web Vitals for Images: LCP, CLS, INP & AVIF

How images drive Core Web Vitals in 2026, and how AVIF cuts LCP. Covers the LCP sub-parts, CLS dimension fixes, INP decode cost, and measurement.

AVIF on WordPress (2026): Core Support, Plugins & Serving

WordPress 6.5 ships AVIF natively but won't convert old JPEGs. What core does, which plugin to pick, and how to verify AVIF is actually served.