PNG and JPG to WebP or AVIF converter
Convert a batch of images in your browser and compare the size before and after. Nothing is uploaded.
- Free
- No account required
EXIF metadata is not carried through canvas encoding: output files have no location or camera data.
- Before
- –
- After
- –
- Saved
- –
Add images to see their size before and after conversion.
Why convert images to AVIF or WebP?
AVIF and WebP usually produce much smaller files at quality close to JPG/PNG.
A smaller image loads sooner, which helps LCP and cuts transfer. Across many pages it also lowers the CO₂e estimate in the Ecology module.
Conversion is local (canvas). Images never leave the browser, and with a large batch the pace is limited by your device memory and CPU.
Compare quality on real images
Test photos, graphics containing text and transparent images separately. Inspect fine edges and tonal transitions. The smallest file is not always the best choice if details are visibly lost.
web.dev, Image formatsHow to convert JPG and PNG to WebP or AVIF
You convert an image to WebP or AVIF at its display size, then add it with a fallback for older browsers. Five steps take you from the source file to checking the image on the page.
-
Prepare the image at its display size
The converter keeps the original dimensions. If a photo is 4000 px wide and the page shows it at 1200 px, resize it first, because a new format does not replace resizing.
-
Choose WebP or AVIF
Drop one or more JPG, PNG, BMP or GIF files and pick the target format. AVIF usually gives a smaller file, but encoding depends on the browser. When the browser cannot write AVIF, the tool converts to WebP and tells you.
-
Set the quality and compare the size
The quality slider runs from 40 to 100. Start at 80, compare the size before and after for each file and zoom in on the result, especially text and sharp edges.
-
Add the image with a fallback
Use a
<picture>element: the AVIF source first, then WebP, and the JPG or PNG file in<img>. Keep thewidthandheightattributes so the browser reserves the space. -
Check the LCP image on the page
If the image is the largest element in the first view, do not give it
loading="lazy"and considerfetchpriority="high". Check the effect with a performance audit of the same page before and after the change.
Examples of adding WebP and AVIF images in HTML
Two patterns that cover most cases: an image with a fallback, and the main image of the first view.
<picture>
<source srcset="/img/hero.avif" type="image/avif">
<source srcset="/img/hero.webp" type="image/webp">
<img src="/img/hero.jpg" width="1200" height="630"
alt="Image description">
</picture> The browser picks the first format it supports. An older browser without AVIF or WebP downloads the JPG file.
<img src="/img/hero.jpg" loading="lazy"
alt="Image description"><img src="/img/hero.webp" width="1200" height="630"
fetchpriority="high" alt="Image description">According to web.dev, lazy-loading the LCP image always delays its download. Dimensions in the attributes let the browser reserve the space and limit CLS.
Common mistakes when converting images to WebP and AVIF
-
A new format without resizing
A 4000 px photo in WebP is still much heavier than the same photo at the width the page shows it. Set the dimensions first, then change the format.
-
AVIF without a fallback
According to web.dev, Chrome has supported AVIF since 2020, Firefox since 2021 and Safari since 2022. An older browser cannot display a format it does not know, so add AVIF in
<picture>with WebP or JPG. -
Lazy-loading the LCP image
The
loading="lazy"attribute on the main image of the first view delays its download and hurts LCP. Keep lazy loading for images below the first screen. -
Missing width and height attributes
Without dimensions the browser does not know how much space to leave, and content shifts once the image arrives. Set
widthandheight, oraspect-ratioin CSS. -
Overwriting the originals
Conversion is lossy and, because it goes through canvas, strips metadata, including copyright information. Each new conversion of an already compressed file adds more loss, so keep the originals separately.
Images on real pages and WebP and AVIF in numbers
| Value | What it means | Source |
|---|---|---|
| 68% | Share of mobile pages whose LCP element contains an image, in 2024. | Web Almanac 2024, Media |
| 911 KB | Median image bytes on a mobile home page in 2025, the largest of all resource types. | Web Almanac 2025, Page Weight |
| 12% and 1% | Share of WebP and AVIF among images on mobile pages in 2024. JPEG had 32.4%, PNG 28.4%. | Web Almanac 2024, Media |
| 25 to 34% | How much smaller lossy WebP files are than comparable JPEG files at equal SSIM quality. | Google, WebP |
| 26% | How much smaller lossless WebP files are than PNG files. | Google, WebP |
| 2022 | The year Safari added AVIF support. Chrome and Opera have supported it since 2020, Firefox since 2021. | web.dev, AVIF |
Sources checked:
Which format to pick?
- AVIFAV1 Image Format
- Often the smallest modern option. Needs browser encode support.
- WebPWeb Picture Format
- Wide support, solid size/compatibility trade-off.
- JPGJPEG
- Legacy standard without transparency, often a fallback.
- PNG
- Lossless with transparency. WebP/AVIF usually cuts transfer a lot.
Drop one or more PNG files above, keep WebP as the target format and set the quality (80 is a good start; go higher for logos and screenshots). Each file shows its size before and after, and WebP keeps PNG transparency. Download the converted files when the list finishes; nothing is uploaded.
Yes, much like JPG. Quality 80 is a good starting point for photos; raise it for logos, screenshots and graphics with text.
Decode yes in newer versions. Encode depends on the browser, otherwise fall back to WebP.
Not with this tool. Conversion goes through canvas, so files come out without location or camera data. If you need the metadata, such as copyright, keep the original.
No. Conversion takes the first frame, so the WebP or AVIF output is a still image, and the saving shown covers that single frame, not the animation.
AVIF usually gives a smaller file than WebP at similar quality, while WebP has a longer history of browser support. The safest option is both in <picture>: AVIF as the first source, WebP second and JPG or PNG as the fallback.
Converting to WebP improves LCP when the LCP element is an image and its download takes long. According to Web Almanac 2024, an image is the LCP element on 68% of mobile pages. Check the effect with a performance audit of the same page before and after the change.
A converted file can be bigger when the original was already heavily compressed or is a small PNG graphic with few colors. Try a lower quality or the other format, and if the result is still bigger, keep the original.
What else might come in handy
File or code ready? Check the result on the live page
A CO₂e estimate and asset weight, broken down by source, with a reduction plan.