AVIF WordPress 2026: Complete Setup Guide [Plugin + Code]
Setup AVIF on WordPress: plugin installation, code snippets, CDN integration. Make WordPress 50% faster →
WordPress AVIF Support
WordPress added native AVIF upload support in version 6.1 (November 2022), but optimal implementation requires additional configuration.
Out of the box, WordPress 6.1+ allows AVIF file uploads through the media library. However, the CMS doesn't automatically convert existing images or generate AVIF thumbnails—you need plugins or custom code for that.
Server requirements also matter. Your hosting must have AVIF support in the image processing library (typically ImageMagick or GD). Many shared hosts now support this, but verification is recommended.
Plugin Options
Several excellent plugins handle AVIF conversion and delivery.
- ShortPixel: Converts images to AVIF on upload or in bulk. Includes CDN option for automatic format delivery.
- Imagify: From WP Rocket team. WebP and AVIF conversion with smart serving based on browser support.
- EWWW Image Optimizer: Local conversion option (no external API). Supports AVIF with proper server configuration.
- Converter for Media: Free option for AVIF/WebP conversion with .htaccess-based serving.
💡 Pro Tip
ShortPixel and Imagify offer the best balance of features and ease of use for most WordPress sites.
Server Configuration
Proper server configuration ensures AVIF files are served correctly.
This configuration checks if an AVIF version of each image exists and serves it to supporting browsers automatically. The original JPEG/PNG remains the fallback.
# Apache .htaccess for AVIF serving
<IfModule mod_rewrite.c>
RewriteEngine On
# Check if AVIF version exists and browser supports AVIF
RewriteCond %{HTTP_ACCEPT} image/avif
RewriteCond %{REQUEST_FILENAME} (.+)\.(jpe?g|png|gif)$
RewriteCond %{REQUEST_FILENAME}.avif -f
RewriteRule ^(.+)\.(jpe?g|png|gif)$ $1.$2.avif [T=image/avif,E=avif:1,L]
</IfModule>
# Nginx configuration
location ~* ^(.+)\.(jpe?g|png|gif)$ {
set $avif_suffix "";
if ($http_accept ~* "image/avif") {
set $avif_suffix ".avif";
}
try_files $uri$avif_suffix $uri =404;
}WooCommerce Integration
E-commerce sites benefit most from AVIF. Here's WooCommerce-specific implementation.
WooCommerce generates multiple image sizes for products: thumbnails, catalog images, and single product images. Ensure your optimization plugin converts all registered image sizes to AVIF.
Product galleries particularly benefit from AVIF. A typical gallery with 5-10 images can see 2-4MB savings, dramatically improving product page load times.
<?php
// Functions.php: Register AVIF support for WooCommerce images
add_filter('woocommerce_product_get_image', function($image, $product) {
// Plugin-specific: Modify image HTML to include AVIF srcset
return apply_filters('avif_product_image', $image, $product);
}, 10, 2);External Resources
Frequently Asked Questions
Does WordPress support AVIF uploads?▼
Which plugin is best for WordPress AVIF?▼
Will AVIF work with my caching plugin?▼
Ready to Convert Your Images?
Try our free AVIF converter - no upload required, 100% private.
Start ConvertingRelated Articles
AVIF for Shopify 2026: Speed Up Store 3x [Implementation Guide]
Implement AVIF on Shopify: reduce image size 50%, speed up store 3x, boost conversions. Complete setup guide →
AVIF in Next.js & React 2026: Implementation Guide [Code Examples]
Implement AVIF in Next.js and React: automatic conversion, Image component, optimization. Complete code examples →
AVIF for Squarespace & Wix 2026: Speed Up Site 3x [Guide]
Use AVIF on Squarespace and Wix: upload tips, custom code, speed optimization. Make site 3x faster →