How WordPress Handles AVIF Uploads and Resizing
Starting with WordPress 6.5, native support for AVIF (AV1 Image File Format) allows users to upload, store, and automatically generate responsive sizes for AVIF images directly through the WordPress Media Library without third-party plugins. This guide explains the core mechanisms WordPress uses to process AVIF uploads, how the system generates intermediate image dimensions, and the server requirements necessary for proper operation.
Core AVIF Integration in WordPress
WordPress treats AVIF as a first-class image format alongside JPEG,
PNG, and WebP. When an AVIF file is uploaded via the Media Library or
block editor, WordPress recognizes its image/avif MIME
type, performs standard security checks, and registers the asset in the
database.
Unlike previous versions where AVIF uploads triggered security or file-type errors, the core platform now reads AVIF metadata—including width, height, and color profiles—natively.
How Image Resizing Works
Once an AVIF image is uploaded, WordPress automatically generates
intermediate sub-sizes (such as thumbnail,
medium, large, and custom registered theme
sizes).
The resizing workflow functions through WordPress's internal image editor abstraction layers:
- Engine Detection: WordPress checks for an active
image processing extension in PHP, prioritizing
WP_Image_Editor_Imagick(ImageMagick) overWP_Image_Editor_GD(GD Library). - Dimension Calculation: The system determines the required crop and scale dimensions defined by the site's media settings and active theme.
- Resizing and Encoding: The active editor processes the source AVIF file and creates new versions scaled down to each required dimension.
- Format Retention: Intermediate sizes are generated natively in the AVIF format, preserving the compression and quality benefits across all generated sizes.
- Responsive Markup: When rendered on the front end,
WordPress includes these resized AVIF images in the standard
srcsetandsizesattributes of the<img>tag, enabling responsive delivery based on the visitor's viewport.
Server-Side Requirements
WordPress can only process and resize AVIF files if the hosting environment provides the necessary underlying libraries. Core support depends on:
- ImageMagick: Requires ImageMagick 7.0.25 or later,
compiled with
libheifsupport for AVIF. - GD Extension: Requires PHP 8.1 or later compiled
with AVIF support via
libavif.
If a server lacks AVIF support in both GD and ImageMagick, WordPress can still store the original uploaded AVIF file, but it will be unable to generate smaller sub-sizes. In such scenarios, the site serves the full-sized original file across all viewports, eliminating the performance advantage of responsive images.
Quality and Compression Settings
WordPress applies a default quality setting to generated AVIF
sub-sizes to balance visual fidelity and file size reduction. Developers
can modify the compression level globally by filtering the output
quality via the wp_editor_set_quality hook, allowing
fine-tuning for specific bandwidth or aesthetic needs.