How to use WebP images in WordPress without a plugin — AVIF, WebP and JPG fallback

WebP and AVIF on WordPress Without a Plugin: Upload, Convert, Fallback

Search for how to use WebP images in WordPress and you will mostly find plugin roundups: install this optimizer, install that converter, let it rewrite your images for you. Plugins have their place, especially for bulk-converting a large existing library. But if you are starting fresh, or you only have a handful of images to deal with, you do not need one at all. WordPress has supported modern image formats in core for years now, and the no-plugin path is simpler than most guides make it sound.

This guide covers exactly that path: what WordPress supports natively and since when, the one server caveat that can trip you up, a convert-before-upload workflow you can do in your browser, and the fallback pattern that keeps your images visible in older browsers too.

What WordPress supports natively (and what it does not)

Here is the part most plugin roundups skip. WordPress core already handles modern formats:

  • WebP uploads since WordPress 5.8 (released July 2021). You can upload a .webp file to the Media Library and use it like any other image — in posts, pages, and as a featured image. WordPress generates the usual thumbnail sizes from it, just as it does for a JPEG.
  • AVIF uploads since WordPress 6.5 (released April 2024). On a site running 6.5 or later, you can upload and use .avif files the same way, provided your server supports the format — more on that below.

What WordPress does not do out of the box is convert your existing images. Upload a JPEG and WordPress will not turn it into WebP or AVIF for you. Native support means you can upload files that are already in those formats. The conversion step is yours, and that is where the workflow below comes in.

Why bother? WordPress’s own developer notes put WebP at around 30% smaller on average than equivalent JPEG or PNG files, and the WordPress 6.5 announcement describes AVIF as up to 50% smaller than JPEG at the same visual quality. Smaller files mean faster pages, and on image-heavy pages the difference is noticeable. Those are WordPress’s published figures, not measurements from this site — your own savings will vary with the image.

The one caveat: your server’s image library

WordPress relies on your server’s image-processing library — Imagick or GD — to handle image files. For WebP this is rarely a problem on modern hosting. For AVIF it matters more: AVIF support in WordPress depends on that library having AVIF support compiled in. If it does not, AVIF uploads and thumbnail generation will fail even on WordPress 6.5 or later.

Check before you commit to AVIF. In your WordPress dashboard, go to Tools → Site Health → Info → Media Handling and look at the list of supported formats. If you see AVIF there, your server can process it. If you do not, contact your host and ask them to enable AVIF support in Imagick or GD — or stick with WebP, which is the safer default anyway.

A quick practical test costs nothing: upload one small AVIF file to the Media Library and confirm WordPress generates its thumbnail sizes. If the upload fails or no thumbnails appear, your server is telling you the answer.

The convert-before-upload workflow

Since WordPress will not convert your images, do it before they reach the Media Library. The workflow is deliberately boring:

  1. Start from your best original. Keep the original JPEG or PNG somewhere safe. You will still want it for fallbacks, social sharing, and any place that needs a traditional format.
  2. Convert a copy to WebP. If the original is a photo, use the JPG to WebP converter. If it has transparency, like a logo or graphic, use the PNG to WebP converter. WebP handles both lossy photos and lossless graphics with transparency, so it is the right default for most images.
  3. Optionally convert a copy to AVIF. For hero images and large photographs where every kilobyte counts, run the original through the image to AVIF converter as well. AVIF is worth the extra step on your biggest images; for small thumbnails and icons the saving is usually too small to matter.
  4. Upload the converted file to the Media Library and insert it into your post or page exactly as you would a JPEG. WordPress treats it like any other image from this point on.
  5. Keep the original. Do not delete the JPEG or PNG. You need it for the fallback pattern below, and for anywhere outside the browser that does not understand modern formats.

That is the whole workflow. No plugin settings, no bulk regeneration, no rewriting rules. It suits new posts, small sites, and anyone who would rather convert ten images deliberately than install a plugin to convert ten thousand automatically.

The fallback pattern: AVIF → WebP → JPG

Here is the gap in the standard advice. When you insert a WebP image with the normal Image block, WordPress outputs a single-format image tag. A visitor on a very old browser that does not understand WebP would get a broken image. In practice that audience is now tiny — all major modern browsers support both WebP and AVIF — but if you want a guarantee rather than a near-certainty, use the HTML <picture> element.

The <picture> element lists the same image in several formats, most modern first. The browser picks the first format it understands and ignores the rest. The pattern looks like this:

<picture>
  <source srcset="hero-image.avif" type="image/avif">
  <source srcset="hero-image.webp" type="image/webp">
  <img src="hero-image.jpg" alt="Describe the image here">
</picture>

How it works, line by line:

  • The browser tries the AVIF source first. If it supports AVIF, it loads that and stops.
  • Otherwise it tries the WebP source. If it supports WebP, it loads that and stops.
  • Otherwise it falls back to the <img> tag, which is an ordinary JPEG every browser can display. The <img> tag is required — it is both the fallback and the element that carries the alt text.

You can use this in WordPress in two places. Inside a post or page, add a Custom HTML block and paste the markup, swapping in your own Media Library URLs for the three files. In a theme template, the same markup works in your theme files — just make sure all three versions of the image exist in the Media Library first, since you converted them yourself in the step above.

One practical note: if you only have a WebP version and a JPEG original, a two-step stack (WebP, then JPG) is perfectly fine. You do not need all three formats for every image. Reserve the full three-format stack for hero images and other high-traffic images where the AVIF saving is worth the extra file.

Gotchas worth knowing before you switch

  • Do not throw away the originals. The fallback pattern needs the JPEG, and so do places outside the browser. Keep the original file for every image you convert.
  • Featured images and social sharing still favour traditional formats. When your post is shared on social media, the platform reads the featured image URL. A JPEG or PNG featured image is the safe choice for sharing previews; save the modern formats for images inside the content.
  • Email and RSS are the least predictable places. Browsers are consistent about WebP and AVIF support; email clients and feed readers are not. If an image has to render inside a newsletter or a feed, use a JPEG or PNG there rather than assuming modern format support.
  • Animated images need a second thought. WebP supports animation, but an animated WebP does not behave identically to an animated GIF in every context. Test an animated conversion in the place it will actually appear before replacing a GIF site-wide.
  • File names matter for your own sanity. Keep the same base name across formats — hero-image.jpg, hero-image.webp, hero-image.avif — so the fallback markup is easy to write and the three files are easy to find together in the Media Library.
  • Existing libraries are a different job. This guide is for new images and small batches. If you already have hundreds of JPEGs in the Media Library, converting them one by one is a poor use of time — that is genuinely the case where a bulk conversion plugin earns its keep.

The short version

WordPress has supported WebP uploads since version 5.8 and AVIF uploads since version 6.5, with AVIF depending on your server’s image library. WordPress will not convert your images for you, so convert before you upload — WebP as the default, AVIF for your biggest images — and keep the original JPEG for fallback. Where you want a guarantee for older browsers, wrap the three versions in a <picture> element and let the browser pick. No plugin required.

Can I upload WebP images to WordPress without a plugin?
Yes. WordPress has supported WebP uploads natively since version 5.8. Upload a .webp file to the Media Library and use it like any other image — no plugin, code snippet, or functions.php edit is needed on a modern WordPress site.

Does WordPress support AVIF images?
Yes, since WordPress 6.5 — with one condition. Your server’s image-processing library (Imagick or GD) must support AVIF. Check Tools → Site Health → Info → Media Handling and look for AVIF in the supported formats list. If it is missing, ask your host to enable it or stick with WebP.

Will WordPress convert my existing JPEGs to WebP automatically?
No. Out of the box, WordPress does not convert images you have already uploaded. Native support means you can upload files that are already in WebP or AVIF format. Convert your images before uploading them, or use a bulk conversion plugin if you have a large existing library.

What happens to visitors on browsers that do not support WebP or AVIF?
If you insert a WebP image with the standard Image block, an unsupported browser cannot display it. Use the <picture> element with AVIF, WebP, and JPEG sources instead: the browser picks the first format it understands and falls back to the JPEG, so nobody sees a broken image.

Should I use WebP or AVIF for my WordPress images?
Use WebP as your default — it is supported natively since WordPress 5.8, works across all major modern browsers, and covers photos, transparency, and graphics. Add AVIF for large hero images and photographs where the extra compression is worth the extra file, once you have confirmed your server supports it.

Similar Posts