Allscreenshots
Sign inGet an API key
Blog

Guide

PNG, JPEG, WebP, AVIF or JPEG XL: which format should a screenshot use?

Erik Lindqvist6 min read

A screenshot is an awkward image to compress. Half of it might be a photograph. The other half is tiny text, one-pixel borders, and a blue button that needs to stay blue.

That makes “use the newest format” a weak default. We captured five public pages and encoded each as PNG, JPEG, WebP, AVIF, and JPEG XL. The smallest file depended on the page and the settings. On two text-heavy captures, our JPEG was actually larger than our lossless PNG.

Here is how to make the choice without guessing.

One capture, five encodings

This is the AllScreenshots homepage, captured at 1280 × 800 on 29 September 2026. It mixes large lettering, fine text, flat backgrounds, and a detailed website preview.

Source screenshot used for the PNG, JPEG, WebP, AVIF or JPEG XL: which format should a screenshot use experiment
AllScreenshots homepage, captured 29 September 2026. The example uses a single captured frame for every format. View source page.

We took a single PNG capture through AllScreenshots and converted it locally. Each encoder received the same opaque, 8-bit sRGB pixels. There was no resizing between formats. The AVIF and JPEG XL files below are local conversions, not claims about API output support.

For the first comparison, the lossy encoders used quality 80. PNG used compression level 9 without palette reduction. JPEG and AVIF used 4:4:4 chroma. WebP used effort 6; AVIF effort 6; JPEG XL effort 7.

EncodingSizeEncode timeSSIMULACRA 2
PNG, level 9297.6 KiB32.3 ms100.0
JPEG, q80 / 4:4:4102.7 KiB7.8 ms80.1
WebP, q80 / effort 641.1 KiB68.5 ms76.9
AVIF, q80 / effort 646.4 KiB704.7 ms89.6
JPEG XL, q80 / effort 763.1 KiB198.2 ms83.3
Bar chart of output file sizes for PNG, JPEG, WebP, AVIF and JPEG XL
File size for this screenshot only. Equal quality numbers do not mean equal visual quality.

Quality 80 is not a shared visual standard. AVIF's score here was 89.6; WebP's was 76.9. The smaller WebP had also discarded more information according to this metric. A table of bytes alone would hide that difference.

SSIMULACRA 2 estimates perceptual similarity to a reference image; higher is better and 100 represents an exact match. It is useful supporting evidence, not a substitute for reading the text in the actual screenshot.

Look at the part your users need to read

The following strips show the same text region after decoding each output. We enlarged them three times using nearest-neighbor scaling, then saved the comparison as PNG so another lossy export would not blur the evidence.

Labeled comparison of the same screenshot crop after decoding each tested format
Decoded crops at 3× nearest-neighbor enlargement. Click to inspect the PNG comparison at full size.

The lossy versions remain readable here. Their edge pixels are not identical: JPEG introduces texture around the lettering, while WebP changes the fine strokes and their surroundings. The differences are more obvious in these enlarged strips than when the whole screenshot is displayed as a small card.

That distinction matters. A thumbnail needs to communicate “this is the right website.” A support article may need a reader to distinguish a colon from a semicolon. Those are different quality requirements.

Open the original files at their native dimensions: PNG · JPEG · WebP · AVIF · JPEG XL.

The page matters as much as the extension

We also captured documentation, a photo gallery, a browser announcement, and an encyclopedia article. These are five examples, not a representative sample of the entire web.

Captured pagePNGJPEG q80WebP q80AVIF q80JXL q80
AllScreenshots homepage297.6 KiB102.7 KiB41.1 KiB46.4 KiB63.1 KiB
MDN CSS documentation119.4 KiB167.8 KiB76.1 KiB89.2 KiB111.8 KiB
NASA image gallery1285.2 KiB167.0 KiB81.5 KiB125.0 KiB102.5 KiB
WebKit release post187.9 KiB124.9 KiB69.2 KiB73.5 KiB86.8 KiB
Wikipedia PNG article217.7 KiB224.8 KiB111.9 KiB148.6 KiB140.2 KiB

The NASA gallery gives PNG much more photographic detail to preserve. MDN gives it repeated backgrounds and sharp text. On the MDN capture, JPEG at these settings grew beyond PNG while still changing the pixels.

Do not turn the winning cell in one row into a global image policy. Try several examples of the content your product actually stores.

What each format changes

FormatCompression used hereTransparency capabilityPractical role
PNGLosslessYesA precise reference or a widely readable master
JPEG / JPGLossyNoA broadly compatible photo-heavy preview
WebPLossy in this table; lossless is also availableYesA delivery candidate worth testing in both modes
AVIFLossy in this table; lossless is also availableYesA delivery candidate when encoding cost is acceptable
JPEG XLLossy in this table; lossless is also availableYesAn additional delivery or storage candidate with decoder checks

JPG and JPEG are two extensions for the same format. Our normalization removed transparency for every output, so this experiment does not compare alpha quality, HDR, animation, or wide-gamut color. MDN's format guide documents the broader format capabilities.

Smaller is not the same as faster

On this homepage, JPEG took about 8 ms to encode and AVIF about 705 ms. Those are local encoder measurements, not screenshot API response times. Navigation, fonts, scripts, capture, upload, and network delivery happen elsewhere in the pipeline.

If you encode once and serve the image thousands of times, spending more time to reduce transfer bytes may be worthwhile. If a user is waiting for a fresh capture on every request, that extra work sits directly in their path.

The timings are medians of three sequential runs after one warm-up on an Apple Silicon Mac. They include file writing. JPEG XL additionally includes starting its command-line encoder and decoding its PNG input; the Sharp encoders receive in-memory RGB. This measures our conversion paths, not isolated codec speed. Exact hardware, versions, runs, and settings are in the measurement report.

Check the receiving browser

JPEG and PNG have longstanding support. WebP and AVIF work in current major browsers, but older browsers and embedded viewers still affect delivery choices. JPEG XL support is changing: Safari added it in 17; Chromium and Firefox published shipping plans in August 2026. Use a fallback rather than treating those plans as proof that every visitor can decode a JXL file. Sources checked 29 September 2026: WebKit, Chromium, and Mozilla.

Choose a policy your team can explain

For visual comparisons, keep a lossless reference. For a thumbnail grid, test WebP and AVIF at the dimensions people actually see. For attachments that must open in unfamiliar software, compatibility may justify JPEG or PNG even when another format is smaller.

Start with the screenshot's job, then set a quality requirement, then compare bytes and encoding cost. AllScreenshots can provide the source capture; your storage and delivery pipeline can keep the original and generate the versions each destination needs.

Find out how easy it is to capture and share pixel-perfect screenshots at scale using Allscreenshots. Sign up for a free account and start integrating your first screenshot API call today.

Start with one request

Free plan: 100 screenshots. No credit card.

Get an API key
  • Full-page captures
  • Popups and repeated sticky bars removed
  • Markdown, JSON and PDF output
  • Crawl a site from one URL
  • Desktop, tablet and phone in one image
  • Works in n8n, Make and Zapier
  • MCP server for AI assistants