Skip to content
Images & media

Stop WordPress Compressing Your Images at 82%

Raise the WordPress JPEG quality default of 82 with one filter, regenerate the thumbnails already stuck at 82, and know when PNG is the better fix.

Published Updated

TL;DR: WordPress encodes every JPEG size it generates at quality 82. Raise it with the wp_editor_set_quality filter, then run wp media regenerate --yes, because the filter alone does nothing to images already in wp-content/uploads. For screenshots and flat UI graphics, raising the number only reduces the damage; uploading a PNG removes it, because PNG is lossless and GD ignores the quality number for PNG files. The WordPress JPEG Quality Filter Generator writes the filter and previews the artifacts on a test pattern, and the WordPress Image Size Lab shows which sizes WordPress makes from your own image.

WordPress encodes every JPEG it generates at quality 82 on a 1 to 100 scale. That default lives in WP_Image_Editor::get_default_quality() and applies to every size WordPress makes from your upload: thumbnail, medium, medium_large, large, 1536x1536, 2048x2048 and every extra size your theme or plugins register. (Which sizes those are, and why one upload becomes eight or more files, is in our guide to the default WordPress thumbnail sizes; the WordPress image sizes cheat sheet lists every core size next to WooCommerce’s.) For photographs, 82 is a sane trade between file size and artifacts. For screenshots, UI captures, charts, logos and anything with sharp text or flat colour, the artifacts are easier to see: noise around letters and banding across smooth gradients.

To change it, add one filter and regenerate your thumbnails. To fix screenshots specifically, the better answer is usually to stop handing WordPress a JPEG in the first place. If the image looked soft rather than noisy straight out of upload, that is a different problem; see why WordPress images look blurry after upload, which is about resolution, not compression.

Where the number 82 actually comes from

WordPress dropped its JPEG default from 90 to 82 in version 4.5 (2016) to make pages lighter. The value is returned by get_default_quality() in wp-includes/class-wp-image-editor.php, which also returns 86 for WebP, and it is read whenever the active editor (WP_Image_Editor_Imagick if your host has Imagick, otherwise WP_Image_Editor_GD) writes a resized file.

The number is applied to each size separately. WordPress decodes your original, resizes it once per registered size, and encodes each result at 82, so one upload goes through the encoder several times. The sizes do not compound on each other, because each one starts from the original. The uploaded file itself is left as it is if it is under the big-image threshold (2560px on the long edge). If it is larger, WordPress writes a resized -scaled.jpg, also at quality 82, and serves that as the “full” size. So “my full-resolution image looks fine but the version on the page looks smeared” usually means srcset picked a quality-82 sub-size or the -scaled file.

How to change the quality

There is one filter to hook. wp_editor_set_quality is the current one. It runs for every format the editor saves and receives the MIME type, so you can branch:

add_filter( 'wp_editor_set_quality', function ( $quality, $mime_type ) {
    if ( 'image/jpeg' === $mime_type ) {
        return 92; // up from 82
    }
    return $quality;
}, 10, 2 );

Put this in a small mu-plugin (wp-content/mu-plugins/) or a site-specific plugin. functions.php works too, but you lose the setting the moment you switch themes.

Since WordPress 6.8 the filter also receives a third argument with the width and height of the size being made, so you could return a different number for small sizes than for large ones. We read that in the WordPress 7.1.4 source and have not run a per-size filter.

You will also see the older jpeg_quality filter recommended. For JPEGs, WordPress applies it right after wp_editor_set_quality and uses whatever it returns, so a jpeg_quality callback in a plugin or theme overrides your number. You don’t need to hook both; if your new quality seems to be ignored, search your plugins and theme for jpeg_quality. A value outside 0 to 100 is replaced by the default, and 0 becomes 1. Both filters, with their arguments, are in the WordPress hooks index.

One thing everyone forgets: this filter only affects images encoded after it is active. Every thumbnail already sitting in wp-content/uploads was written at 82 and will stay at 82. Regenerate them:

wp media regenerate --yes

If you are not on WP-CLI, the Regenerate Thumbnails plugin does the same thing through the admin.

Raising the quality number also raises every size’s file size, which adds up across a large media library. If wp-content/uploads is already ballooning, read why the WordPress uploads folder gets too big before you regenerate everything at 92 or 100.

Before you commit to a number, look at what a given quality does instead of guessing. The JPEG Quality Filter Generator re-encodes a test pattern with a gradient and hard edges in your browser at the quality you pick, shows the file size, and writes the filter. Your browser’s JPEG encoder is not GD or Imagick, so its byte counts will not match WordPress’s exactly; the measurements below are from WordPress itself.

What 82, 92, 100 and PNG cost: measured in WordPress

On 2026-11-01 we uploaded one 1280 x 1208 screenshot of a WordPress admin screen to WordPress 7.1.4 (PHP 8.3, GD image editor, Twenty Twenty-Five, in WordPress Playground), once as a JPEG saved at quality 100 (467,979 bytes) and once as a PNG (72,515 bytes). The JPEG was processed with no filter, then with wp_editor_set_quality returning 82, 92 and 100. The PNG was processed with no filter and with the filter returning 92.

Bar chart of the 768px copy of one screenshot: JPEG at the default 82 is 54,660 bytes, JPEG at 92 is 105,874 bytes, JPEG at 100 is 253,714 bytes, and PNG is 109,630 bytes
Measured sizes from one test: a 1280 x 1208 screenshot of a WordPress admin screen, processed by WordPress 7.1.4 in WordPress Playground with the GD image editor. Other images will give different numbers.
Size WordPress madeJPEG, default 82 (bytes)JPEG, 92JPEG, 100PNG
thumbnail, 150 x 1504,0336,31416,4419,650
medium, 300 x 28311,17818,09347,43626,874
medium_large, 768 x 72554,660105,874253,714109,630
large, 1024 x 96684,738170,835385,444167,311

Three things in that table are worth knowing. The filter returning 82 gave byte-identical files to no filter at all, which confirms 82 is the default. Going from 82 to 92 made the JPEG sizes 57% to 102% larger (the bigger the copy, the bigger the jump), and 100 made them four to four and a half times the default. And the PNG run with the filter set to 92 produced byte-identical files to the PNG run without it: GD does not use the quality number for PNG.

These are file sizes only. We did not measure how much each version differs from the original pixel by pixel, so judge the visible difference on your own images.

The better fix for screenshots and flat graphics

Raising the JPEG number treats the symptom. JPEG’s compression is designed for photographic detail, and it struggles with the hard black-on-white edges of text and UI chrome, which is why quality 82 looks so much worse on a screenshot than on a photo of a beach.

Upload a PNG instead. WordPress keeps PNG sub-sizes as PNG, and PNG is lossless, so the resized copies have no compression artifacts, only resampling. It isn’t automatically smaller, though. In the test above, GD’s PNG sub-sizes were two to two and a half times the size of the default JPEG ones. For the two larger copies they were close to JPEG at 92 (109,630 against 105,874 bytes at 768px) and under half of JPEG at 100. The 768px and 1024px copies were even larger than the uploaded PNG itself (72,515 bytes), most likely because resizing adds in-between colours that compress less well. PNG was smaller than JPEG at 100 at every size, so if you were going to raise JPEG quality to 100 for screenshots, PNG is both cleaner and lighter.

If you want the smaller files of a lossy format without as much edge damage, WebP is the middle ground. Its default in WordPress is 86, and you control it through the same wp_editor_set_quality filter shown above, branching on image/webp.

WordPress 7.1 can also make image sizes in the browser instead of on the server, in Chrome and Edge 137 and later on an HTTPS or localhost site. The WordPress developer documentation says that path honours the same wp_editor_set_quality and jpeg_quality filters. Our numbers above come from GD on the server, and we have not measured the browser path.

What not to do

Do not set quality to 100 globally. Quality 100 JPEG is not lossless, since it still quantizes, and it makes every image much larger: in the test above, the large copy went from 84,738 bytes to 385,444. On photographs that extra weight buys little you can see, and it slows Largest Contentful Paint. Raise the number for the format that needs it, or change format for graphics.

Do not edit class-wp-image-editor.php. Changing the return value of get_default_quality() in core works until the next wp core update silently overwrites it. Use the filter.

Do not disable image sizes to “avoid the compression.” The sizes you keep are still encoded at 82, and without the smaller sizes responsive srcset has nothing to offer, so browsers download a large file on phones.

Do not assume the filter fixes existing images. If you set the filter but skip the regenerate step, every old size is still quality 82. The filter only affects what WordPress encodes from then on.

Do not blame the -scaled file if your images are under 2560px. That step never runs for them. If you are hitting it and want the untouched original served, that is a separate setting: the Disable WordPress -scaled Images generator writes the filter, and the guide on why WordPress adds -scaled to images explains when to raise the cap and when to turn it off.

Still stuck?

If a specific size still looks wrong after regenerating, confirm which file the page is actually serving. Open the image in a new tab and check whether the filename ends in a dimension suffix (-1024x768.jpg) or -scaled.jpg. The Image Size Lab shows every size WordPress generates from one upload, so you can see which one your srcset is handing to the browser and stop debugging the wrong file.

Sources

William Lopez

William Lopez is the founder of Odie Themes. He builds the free WordPress tools and themes on this site and has been on WordPress.org since December 2019.

WordPress.org About

FAQ

Questions

Why do my WordPress images look worse after I upload them?

WordPress encodes every JPEG size it generates at quality 82 on a 1 to 100 scale (WebP at 86), so the thumbnail, medium, medium_large and large versions all lose some detail. That setting is a reasonable trade for photographs, but on screenshots, charts, logos and anything with sharp text it can leave visible noise around edges and banding in gradients.

How do I change the JPEG quality in WordPress?

Hook the wp_editor_set_quality filter and return a higher number, such as 92, when the MIME type is image/jpeg. Place it in a mu-plugin or a site-specific plugin rather than functions.php, since switching themes loses the setting. The older jpeg_quality filter runs after it for JPEGs and can override it, so if your number seems to be ignored, look for a plugin or theme that hooks jpeg_quality.

Does changing the quality filter fix images I already uploaded?

No. The filter only affects images encoded after it becomes active, so every size already sitting in wp-content/uploads stays at quality 82. Regenerate them with the WP-CLI command wp media regenerate --yes, or use the Regenerate Thumbnails plugin through the admin if you are not running WP-CLI.

Why does WordPress add -scaled to my image filename?

Because the upload was larger than the big-image threshold of 2560px on its longest edge. When that happens WordPress writes a resized -scaled.jpg at quality 82 and serves that as the full size. Images under 2560px skip that step, so their original file is served as uploaded, unless WordPress has to write a -rotated copy for a photo with an EXIF rotation flag.

Should I set the WordPress JPEG quality to 100?

No. Quality 100 JPEG is not lossless, it still quantizes, and it makes every image much larger: in our screenshot test the large copy grew from 84,738 bytes at the default to 385,444 bytes at 100. Raise the number only for the format that needs it, or upload screenshots and flat graphics as PNG instead.