In short
Images are consistently the largest single component of an average web page's transferred bytes, which makes format choice one of the highest-leverage performance decisions available. JPEG, PNG, WebP and AVIF each make different trade-offs between compression efficiency, quality, transparency and browser support, and choosing well — alongside responsive sizing and lazy loading — often matters more than any other single optimisation on a content-heavy page.
Across large-scale measurement of real websites, images have for years made up the single largest share of the median page's transferred bytes, ahead of JavaScript, CSS and fonts combined on many sites. That makes the format an image is saved in, and the settings used to encode it, one of the most consequential and most frequently mishandled decisions in web performance.
The core trade-off in every image format is the same: how much visual information can be discarded or approximated before a human viewer notices, and how efficiently the remaining information can be packed into bytes. Different formats answer that question differently, and the right choice depends on the content of the image as much as on the format itself.
Lossy versus lossless compression
Lossless compression, used by PNG and optionally by WebP, guarantees the decoded image is pixel-for-pixel identical to the source. It works well for images with large flat areas of colour, sharp edges and text — screenshots, logos, diagrams — where pattern-based compression can find a lot of redundancy without discarding anything.
Lossy compression, used by JPEG and optionally by WebP and AVIF, deliberately discards information that the human visual system is least likely to notice, exploiting the fact that the eye is more sensitive to changes in brightness than to changes in colour, and less sensitive to fine detail in busy, high-frequency areas of an image than in smooth ones. Photographs, with their continuous tonal gradients and natural noise, compress far more efficiently as lossy files than as lossless ones, often by an order of magnitude in file size for a visually indistinguishable result.
JPEG: the incumbent
JPEG, standardised in 1992, works by transforming blocks of pixels into frequency components using a discrete cosine transform, then discarding the high-frequency components a viewer is least likely to miss and compressing what remains. It has no support for transparency and no efficient support for sharp edges or text, which is why screenshots and logos saved as JPEG often look blurred and gain visible blocky artefacts around hard edges. Its enduring advantage is universal support: every browser, email client and image tool made in the last three decades can open a JPEG.
PNG: lossless with transparency
PNG uses lossless DEFLATE compression and supports full alpha-channel transparency, which made it the default choice for logos, icons and any image needing a transparent or semi-transparent background. Its lossless nature makes it a poor choice for photographic content, where file sizes can be five to ten times larger than an equivalent-quality JPEG for the same image.
WebP: a practical middle generation
WebP, developed by Google and released in 2010, supports both lossy and lossless compression, transparency, and simple animation, aiming to replace JPEG, PNG and animated GIF with one format. Google's own published benchmarks found lossy WebP files around 25 to 34 percent smaller than comparable-quality JPEGs, and lossless WebP around 26 percent smaller than comparable PNGs. It reached support across all major browsers by 2020, which took it from a niche optimisation to a safe default for most production use.
AVIF: the newest widely supported format
AVIF is based on the intra-frame compression of the AV1 video codec and generally achieves better compression than WebP at equivalent visual quality, particularly at lower bitrates and on images with complex detail, alongside support for transparency, animation and high dynamic range. The trade-off is heavier encoding computation — producing an AVIF file takes noticeably longer than an equivalent JPEG or WebP — and, on some content types such as images with fine text, WebP or even well-tuned JPEG can still hold up better, so testing rather than assuming AVIF is always smaller matters in practice.
| Format | Compression | Transparency | Animation | Browser support |
|---|---|---|---|---|
| JPEG | Lossy only | No | No | Universal |
| PNG | Lossless only | Yes (full alpha) | No (APNG exists but rarely used) | Universal |
| WebP | Lossy or lossless | Yes | Yes | All major browsers since 2020 |
| AVIF | Lossy or lossless | Yes | Yes | All major browsers since 2023, with some older versions excluded |
Illustrative file size for a photographic image at comparable visual quality
Kilobytes, relative to an unoptimised source PNG
Figures are illustrative and drawn from published format comparisons; actual results vary considerably by image content, encoder settings and quality target.
Format choice is only part of the picture
Choosing the most efficient format still leaves two other decisions that often matter just as much in practice: serving an image at the size it will actually be displayed, and controlling when it loads relative to the rest of the page.
Responsive images
The srcset and sizes attributes, and the picture element, let a browser choose from several versions of an image based on the viewport size and pixel density of the device actually loading the page, rather than downloading one large master file everywhere. Serving a 2000-pixel-wide hero image to a 360-pixel-wide phone screen wastes bandwidth regardless of how efficiently that image was compressed, so responsive markup and format choice are complementary, not competing, optimisations.
Lazy loading
The native loading="lazy" attribute defers fetching an image until it is close to entering the viewport, which reduces the bytes needed for a page's initial render, particularly on long, image-heavy pages, without needing any JavaScript library. It should generally be avoided on the image likely to be a page's Largest Contentful Paint element, since deferring that specific image can make the page appear to load more slowly rather than faster.
Adopting AVIF as a default format today
Pros
- Meaningfully smaller files than WebP on most photographic content at equivalent visual quality
- Supports transparency, animation and high dynamic range in one format
- Now supported by all major browser engines, removing the main historical objection
Cons
- Encoding is significantly slower than JPEG or WebP, which matters at build-time or upload-time scale
- Not every image type benefits equally; some detailed or textual images compress better in WebP
- Still needs a fallback format served via the picture element for any remaining unsupported clients
- Serve AVIF or WebP with a JPEG or PNG fallback inside a picture element, letting the browser pick the best format it supports.
- Generate multiple resolutions of each image and serve them with srcset rather than one fixed size for every device.
- Set explicit width and height attributes so the browser can reserve layout space before the image loads, preventing layout shift.
- Lazy-load below-the-fold images but load the hero or first visible image eagerly.
- Recompress and strip unnecessary metadata from user-uploaded images automatically rather than serving them unmodified.
Key points
- Images remain the largest share of transferred bytes on the median web page, making format choice high-leverage work.
- Lossless formats such as PNG suit flat-colour and text-heavy graphics; lossy formats such as JPEG suit photographs.
- WebP and AVIF generally outperform JPEG and PNG at equivalent visual quality, with AVIF usually smallest but slower to encode.
- Responsive sizing with srcset and lazy loading address bytes and timing respectively, independent of format choice.
- The Largest Contentful Paint image should be loaded eagerly, never deferred with lazy loading.
Sponsored video
AdvertisementChecking for a video ad…
Frequently asked questions
Sources
- Image file formats — Web media technologies — Mozilla Developer Network
- A new image format for the Web (WebP compression study) — Google Developers
- HTTP Archive: State of Images — HTTP Archive / Web Almanac
- Serve images in next-gen formats — web.dev (Google)
About the author
Michael Adeyemi — Senior Technology Writer
Michael writes Inquro's computing and web-infrastructure coverage. He worked for eight years as a platform engineer on high-traffic content systems before moving into full-time technical explanation, and he still prototypes every measurement described in his articles before publishing the numbers.
- Qualifications
- MSc, Distributed Systems — University of Manchester
- BEng, Computer Engineering — University of Lagos
- Experience
- Eight years as a platform engineer on high-traffic content delivery systems
- Four years writing standards-based technical documentation
- Subject areas:
- Web performance, Networking, Systems architecture
- Contact:
- michael@inquro.example
Reviewed for factual accuracy by Dr. Rina Halvorsen, Editor-in-Chief (PhD, Cognitive Science), on 2 June 2026.
Structure, claim strength and whether an explanation actually answers the question a reader arrived with.
Inquro articles are commissioned, sourced, reviewed and re-checked under a published editorial policy. Corrections are made in place and dated — write to editorial@inquro.example if you find an error.






