How does WordPress resize uploaded images?
Every time you upload an image, WordPress creates several resized copies (“sub-sizes”) so themes can serve an appropriately sized file instead of the multi-megabyte original. Out of the box that means thumbnail (150×150, cropped), medium (300×300), medium_large (768 wide), large (1024×1024) and, since WordPress 5.3, 1536x1536 and 2048x2048. Themes and plugins add more with add_image_size(), which is why a single upload can turn into ten or more files.
Proportional sizes are bounding boxes: the image is shrunk until it fits inside the width and height, keeping its aspect ratio (wp_constrain_dimensions()). Cropped sizes are resized to cover the box and then cut to the exact dimensions from the chosen crop position (image_resize_dimensions()). WordPress never upscales: if the original is not larger than a size in either dimension, that file is simply not created.
Uploads larger than the big image size threshold (2560px by default) are scaled down to a -scaled copy that becomes the “full” size used on the front end; the original is kept, and sub-sizes are still generated from it. This calculator runs ports of those core functions in your browser, so the dimensions match what WordPress actually produces.
How to use the WordPress Image Size Calculator
- Enter the width and height of the image you plan to upload, or choose a preset such as a 4032×3024 phone photo. Pick PNG if applicable — PNGs are never scaled by the threshold.
- Adjust the default sizes to match Settings → Media, untick sizes you want to disable, and change or turn off the big image threshold.
- Add your theme’s custom sizes with width, height, hard crop and crop position.
- Read the table of generated files and srcset widths, then copy the PHP to register the sizes, disable unused ones and adjust the threshold.
Example
A 4032×3024 photo with the default settings creates 8 files:
photo.jpg 4032×3024 (original, kept)
photo-scaled.jpg 2560×1920 (full size)
photo-150x150.jpg 150×150 thumbnail
photo-300x225.jpg 300×225 medium
photo-768x576.jpg 768×576 medium_large
photo-1024x768.jpg 1024×768 large
photo-1536x1152.jpg 1536×1152 1536x1536
photo-2048x1536.jpg 2048×1536 2048x2048How srcset uses these files
When an image is output with wp_get_attachment_image() or inserted in a post, WordPress adds a srcset attribute listing every generated file with the same aspect ratio as the displayed size, up to 2048px wide (max_srcset_image_width). The browser then picks the smallest file that fills the slot on the visitor’s screen. Cropped sizes with a different ratio, such as a square thumbnail of a landscape photo, are never mixed in — which is why a good set of proportional sizes matters more for performance than many cropped ones.
Tips for choosing image sizes
- Register only the sizes your theme actually uses: each size multiplies storage and upload processing time.
- Disable sizes you never output with the
intermediate_image_sizes_advancedfilter — the generated PHP does this for any size you untick. - Use hard crops for grids and cards that need identical shapes; use proportional sizes for content images so srcset can work.
- After adding or changing sizes, regenerate existing images with
wp media regenerate --only-missing(WP-CLI) or a regenerate-thumbnails plugin. - Need the dimensions for a specific ratio? Use the Aspect Ratio Calculator, and register sizes alongside other theme code with the functions.php generator.
Frequently Asked Questions
Why does WordPress add “-scaled” to my image file names?
Since WordPress 5.3, images wider or taller than 2560px are scaled down and saved with a -scaled suffix. That copy is used as the full-size image on the site, while the original stays on the server. Return a different number from the big_image_size_threshold filter to change the limit, or false to disable it.
Why was a size not generated for my image?
WordPress does not upscale. If the original is smaller than or equal to the size in both dimensions — or within one pixel of the original — no file is created and the next larger file (or the original) is used instead.
What is the difference between hard crop and soft crop?
Soft crop (proportional) fits the whole image inside the box, so one dimension is usually smaller than requested. Hard crop fills the box exactly and trims the overflow from the chosen position, e.g. array( 'center', 'top' ) keeps the top of the image.
How do I change the thumbnail, medium and large sizes?
In Settings → Media, or with WP-CLI such as wp option update medium_size_w 400. These sizes are stored as options, not code. The 1536 and 2048 sizes are registered in code by core and can be removed with the intermediate_image_sizes_advanced filter.
Does WordPress create WebP or AVIF sizes?
WordPress keeps the uploaded format by default. WebP and AVIF uploads are resized like JPEGs, and since WordPress 5.8/6.5 support is built in; converting JPEG sub-sizes to WebP requires the image_editor_output_format filter or a plugin.