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 input | Expected behavior | Check |
|---|---|---|
| 4000 × 3000 photo, ratio locked | 1200 × 900 copy | Check whether this fits the actual display size |
| Small source enlarged | More pixels, no recovered detail | Obtain a higher-resolution source when possible |