How to Choose the Best Image Size for a Website
A web image should be large enough for its rendered slot and display density, but no larger than the responsive layout can use.
Published September 1, 2026 · 7 min read
Start from the rendered size, not the camera file
Measure the largest width at which the image appears in the layout. An image displayed at 800 CSS pixels does not need a 5,000-pixel source delivered to every visitor. A higher-density variant can be useful, but the browser should be able to choose it instead of downloading it unconditionally.
Use responsive variants
Create multiple widths for large content images and let the site deliver an appropriate source for the visitor’s viewport. Provide accurate width and height information so the browser can reserve space before the file arrives and reduce layout movement.
- Resize close to the largest real display width.
- Generate smaller variants for narrow screens.
- Set intrinsic width and height or an equivalent aspect ratio.
- Avoid lazy-loading the primary image visible at the top of the page.
Match the format to the content
Use JPG or WebP for photographs when lossy compression is acceptable. Use PNG for assets that require lossless pixels or transparency, while recognizing that photographic PNG files can be large. Compare results because no format is smallest for every image.
Optimize for experience, not a universal file limit
There is no single ideal kilobyte target for every image. A full-width hero and a small icon have different visual and performance budgets. Monitor real loading performance and focus on the images that delay the largest visible content.
Compression should happen after resizing. Inspect the final asset at its intended display size, not only while zoomed in inside an editor.