Image sizes for websites: how big, which format, and srcset
Serve each image at about 2× the size it's shown on a phone (a photo shown 400 px wide: ~800 px), as WebP (or AVIF) with a JPEG fallback if needed. Add srcset/sizes so big screens get bigger copies. width and height on every image. loading="lazy" on images below the fold, never on the first big image, which gets fetchpriority="high".
The details
| Shown at | Export | Weight |
|---|---|---|
| Shown on a phone at | ~2× copy | Typical WebP |
| 390 px (full width) | ~800 px | 60–150 KB |
| 200 px (card) | ~400 px | 20–50 KB |
| Hero on desktop, 1280 px | 1600–2000 px (srcset) | 150–300 KB |
Rules of thumb, not a standard; measure the result.
What usually goes wrong
- Camera photos (3–4 MB) shown at 400 px.
- loading="lazy" on the hero.
- A single 2000 px image for phones and desktops.
Before and after, from Palm's tests
| Measured | Without Palm | With Palm |
|---|---|---|
| Largest paint (median) | 9.3 s | 1.7 s |
| Page weight | 2.4 MB | 1.1 MB |
Palm's site-speed test: both sides resized the photos; only the side that could measure got the hero light enough.
Same agent (Claude Code), same request, a fresh folder each run; judged blind by a separate session that never knew which side used Palm. All results.
What your agent can't do alone
Palm's site-speed (Pro) measures on a throttled phone and writes right-sized WebP copies of every image, with the tag to use.
Questions
Should I use WebP or AVIF?
WebP is supported everywhere current; AVIF is smaller but slower to encode. Either beats JPEG for size.