Media & Content Guide Intermediate 3 min

JPEG Quality, WebP and AVIF in WordPress 7.1: What to Set and Why

Images are the heaviest part of most pages. What WordPress 7.1 does with your uploads, when to switch to WebP or AVIF, which quality setting to use, and what changed with in-browser image processing.

TutorialIntermediate12 minTested on WordPress 7.1Updated November 13, 2026

Images are usually the heaviest part of a page, and the part visitors wait for. WordPress already does a lot automatically: it scales huge photos, creates several sizes and serves the right one with srcset. A couple of settings decide how big those files are.

What WordPress does with an upload

When you upload a photo, WordPress:

  1. Scales it if either side is wider than 2560 pixels, keeping your original as a backup.
  2. Creates smaller sizes: thumbnail, medium, large and any your theme adds.
  3. Compresses JPEGs at quality 82, a good balance between size and visible quality.
  4. Picks the right size per screen with srcset, so phones don’t download desktop images.

New in WordPress 7.1: processing in the browser

WordPress 7.1 can now do that resizing and compression in the editor, in your browser, using a WebAssembly build of the libvips image library, before the file reaches the server. When the browser can’t, WordPress falls back to the server as before, with nothing for you to do.

For you this means faster uploads on slow hosts, AVIF support even when your server’s GD or Imagick can’t handle it, and iPhone HEIC photos that turn into JPEGs automatically. The quality and format filters below still apply, because the browser follows the same WordPress settings.

Step 1: choose a format

FormatSize vs JPEGBrowser supportGood for
JPEGbaselineevery browserfallback only
WebPabout 25–35% smallerevery current browsermost sites
AVIFoften smaller than WebPevery current browserphoto-heavy sites
PNGmuch larger for photosevery browserscreenshots, logos with sharp edges

WebP is the safe choice for almost every site. AVIF usually produces smaller files at the same quality but takes longer to encode. With 7.1’s in-browser processing that cost moves to the editor’s computer, so it’s more practical than it used to be.

Step 2: switch new uploads to WebP

functions.phpPHP
add_filter( 'image_editor_output_format', function ( array $formats ): array {
	$formats['image/jpeg'] = 'image/webp';
	$formats['image/png']  = 'image/webp';
	return $formats;
} );
Tested on WordPress 7.1 · PHP 8.3Checked November 13, 2026

Want AVIF instead? Change image/webp to image/avif in the snippet. If your server can’t encode AVIF and the editor’s browser can’t either, WordPress keeps the original format, so nothing breaks.

Prefer a plugin?

The WordPress Performance Team’s Modern Image Formats plugin does the same with a setting under Settings → Media, picks AVIF automatically when your server supports it, and can also output JPEG fallbacks.

Step 3: leave quality alone (mostly)

Quality 82 is a sensible default for JPEGs. Lowering it saves a little more, but text and gradients in screenshots start to show blocky artefacts. If you do change it, test with your real photos:

Snippet

Set JPEG Compression Quality

Override WordPress's default JPEG quality setting of 82 to control the file size and visual quality balance for all uploaded and regenerated images.

PHPBeginner
View

A good rule: below 75, savings get small and artefacts get visible.

Step 4: tune the size threshold

If your theme never shows images wider than, say, 1600 pixels, there’s no need to keep a 2560-pixel scaled copy:

Snippet

Change the Size WordPress Scales Large Images To

Change the 2560 px limit WordPress uses to scale down huge uploaded photos, for example to 1920 px.

PHPBeginner
View

And drop the generated sizes your theme never uses, so each upload creates fewer files:

Snippet

Remove Unused Generated Image Sizes

Stop WordPress from generating image size variants that your theme and plugins never use, reducing disk usage and speeding up media uploads.

PHPBeginner
View

Check the result

You should now see

Upload a new JPEG and open it in Media → Library. The file address of the sizes ends in .webp (or .avif). On the front end, the browser’s Network tab shows the smaller format for that image.

Uploads are still JPEG3 common fixes
  • Older images don’t change. Only new uploads are converted. Use a “regenerate thumbnails” plugin or wp media regenerate for the rest.
  • Your server can’t write WebP. Check Tools → Site Health → Info → Media Handling. Ask your host to enable WebP in GD or Imagick.
  • A CDN or optimisation plugin converts images too. Pick one tool for conversion, or files get compressed twice.

Summary

Keep quality 82 and the 2560-pixel threshold unless you have a reason. Switch new uploads to WebP with one snippet, or AVIF if your images are mostly photos. Remove sizes your theme doesn’t use, and regenerate older images when you have time.

Check your understanding

1Which filter decides the file format WordPress saves image sizes in?
2What happens to images uploaded before you switch to WebP?

Was this helpful?

Written by Nahnu Plugins

We build and maintain WordPress plugins. Every guide is tested on a fresh WordPress site before it goes out, and checked again when WordPress updates.

More guides

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only