How to choose image dimensions and format for the web

A clear workflow for matching image dimensions, pixel density and file format to the place where an image appears.

Published: 2026-07-27 · Updated: 2026-11-09 · SwiftlyKit

Begin with the display slot

Measure the largest width at which the image will appear. A card thumbnail and a full-width hero image have different requirements. Exporting every asset at the camera's original resolution wastes bandwidth and can make mobile pages feel slow.

Account for high-density screens

A common approach is to provide an image near twice the CSS display width for high-density screens, then let responsive markup choose an appropriate source. This is a guideline rather than a fixed rule; detailed artwork may need more, while simple graphics may need less.

Match format to content

Photographs usually suit JPEG or lossy WebP. Transparent graphics and sharp interface elements suit PNG or lossless WebP. The best format is the one that meets compatibility and visual requirements at a reasonable size.

Avoid enlarging small originals

Increasing pixel dimensions cannot recreate missing detail. It can make an image larger without making it sharper. Use SwiftlyKit Image Resizer to create delivery copies while retaining the untouched original as your editing master.

Check a concrete example

These examples explain expected behavior, not measured speed or compression savings. Check the output separately using your own file.

Example inputExpected behaviorCheck
4000 × 3000 photo, ratio locked1200 × 900 copyCheck whether this fits the actual display size
Small source enlargedMore pixels, no recovered detailObtain a higher-resolution source when possible

Try the related SwiftlyKit tools

Image Resizer

PNG ↔ JPG Converter

Image Compressor

Sources and further reading

Google: WebP compression techniques