Wydajność i bezpieczeństwo

AVIF in WordPress 6.5: should you switch the image format on your site

· Krzysztof Balicki

A camera with a large lens on a table by a window

Since WordPress 6.5, released in April 2024, you can upload AVIF images just like JPEG or PNG. There is one condition: your server has to support the format. For most online stores and company websites, AVIF in WordPress is a sensible move, but roll it out step by step instead of swapping out the whole media library at once (that is an easy way to run into trouble). Below I explain what the format gives you, how to check your hosting, how to switch to the new files and when it is better to wait.

What is the AVIF format and what does WordPress 6.5 change?

AVIF is a modern image format. It compresses better than JPEG, PNG and even WebP, while keeping higher quality. WordPress 6.5 supports it natively. According to the WordPress Core team announcement, AVIF files can be up to 50% smaller than JPEG at the same quality. On top of that you get a wide color range, including HDR, and better rendering of fine details, such as fabric texture or leaves in the background. One more thing: AVIF works well with the features WordPress uses by default.

  • Responsive images - the browser downloads the version that fits the screen width.
  • Fetch Priority - the most important image on the page, such as a banner, is downloaded first.
  • Lazy loading - images outside the screen load only when the visitor scrolls down.

What does a store or company website gain from AVIF images?

Smaller files. That means faster loading and less bandwidth used, both on the server and on the visitor’s side. Stores with hundreds of product photos in WooCommerce or PrestaShop will feel it most, since a single category listing can weigh more than the rest of the site put together. A customer on a phone, often with a weak signal, will see the gallery and product page sooner. Will this instantly bring higher rankings or more sales? No, speed does not guarantee anything like that. But it removes one of the reasons people close the tab before buying. And since all major browsers support AVIF, most websites can start using it right away.

How to check if your server supports AVIF in WordPress?

This does not depend on WordPress itself but on the image processing library on the server, Imagick or LibGD. Checking takes a minute:

  1. Log in to the dashboard and go to Tools -> Site Health.
  2. Open the Info tab.
  3. Expand the Media Handling section.
  4. Look for AVIF in the list of supported formats.

No AVIF on the list? Ask your hosting provider to update Imagick or LibGD to a version that supports it. Multisite is a separate story. Existing sites in the network will not get AVIF automatically, because the list of allowed file types is saved when a site is created. The fix is a site_option filter in a network mu-plugin. That is a job for an administrator or developer, not for the person handling content.

WebP or AVIF: which format to choose for WordPress 6.5 images?

AVIF usually wins: smaller files, better quality. WebP, on the other hand, is the safer choice when your server or part of your audience cannot handle AVIF. In my view, the decision is best based on three questions. Does your hosting support the new format? Which browsers do your customers use? And does your designer or the person adding products have a tool to export AVIF? You will find browser data in your site statistics. If a large group of visitors uses older versions, you can stay with WebP or add a polyfill, a script that teaches an old browser a missing feature.

How to switch to AVIF: converting and uploading images

The simplest way: export images to AVIF before uploading and then use them in WordPress like any other image. One of several tools is enough for the conversion:

  • export from a graphics program, since many editors already have this option,
  • command line tools, handy for large batches of files,
  • open web tools such as Squoosh, where you can compare quality side by side.

Also, WordPress can create AVIF files from uploaded JPEGs on its own. This is done with the image_editor_output_format filter, which sets the format that uploaded files are converted to. Setting it up is a developer’s job. No such person on your team? You can order the automation as a custom plugin, built for example by K4.pl.

When is it better to hold off on changing the format?

When your hosting does not support AVIF, when a multisite network runs without the fix, or when many of your customers use browsers without support for the format. In those cases there is no need to rush. Before switching, also review your image optimization plugins, theme and integrations, such as product feeds for price comparison sites or syncing with PrestaShop. Not every one of them will accept the new files. The order I recommend: new images and the heaviest graphics first, meaning banners and galleries, and the rest later (if it is needed at all).

For a small or medium business, it is actually quite simple. Check Site Health, test a few files on a product page and see if everything displays correctly. Works? AVIF in WordPress can become the default format for new images, while the old library stays as it is.

Frequently asked questions

Will my images turn into AVIF on their own after updating to WordPress 6.5?

No. Existing files stay in their current format. AVIF will only appear when you upload such files yourself or a developer sets up a conversion filter for new uploads.

Does AVIF work in every browser?

In all the major ones, yes. If some of your customers use older versions, you can stay with JPEG or WebP or add a polyfill.

What if AVIF is missing in Site Health?

Ask your hosting provider to update Imagick or LibGD to a version with AVIF support. Until then, stay with WebP or JPEG, which WordPress supports without any extra changes.