---
title: "Tech Tip #42: Serve images at the size they're shown"
description: "That 4000-pixel photo is displayed 400 pixels wide."
url: https://greencode.ai/tech-tips/42-size-images-for-the-screen/
---

# Tech Tip #42: Serve images at the size they're shown

**That 4000-pixel photo is displayed 400 pixels wide.**

[Watch the video](https://media.greencode.ai/shorts/size-images-for-the-screen-b478ef842d68.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

Pages send one large original image to every device and let the browser shrink it. Phones download many times the pixels they can show.

### The fix you can use today

- Generate several widths of each image at build time or through an image CDN.
- Use srcset and sizes so the browser picks the nearest size.
- Check in your page audit for images much larger than their display size.

The Green Software Foundation suggests serving images at the size they are shown. GreenCode draws on these patterns when it checks software.

### Tools that help

- [Lighthouse](https://developer.chrome.com/docs/lighthouse/overview?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): audits a page for total byte weight, unused JavaScript and CSS, image formats and offscreen images
- [WebPageTest](https://www.webpagetest.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): loads a real page and shows every request, its size and when it loaded

### How GreenCode helps

GreenCode helps tackle this by practising it on greencode.ai: WebP images, scripts only where they are used and leaner pages cut a first view of the home page from 6.8 MB to 1.7 MB. [More on this](https://greencode.ai/green-hosting/).

### Tags

#images#web-performance#frontend

### Sources

- [Green Software Foundation, Green Software Patterns: Optimize image size](https://github.com/Green-Software-Foundation/patterns/blob/main/docs/development/media-and-code-efficiency/properly-sized-images.md?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [Green Software Foundation, Green Software Patterns: Serve images in modern formats](https://github.com/Green-Software-Foundation/patterns/blob/main/docs/development/media-and-code-efficiency/serve-images-in-modern-formats.md?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [HTTP Archive, Web Almanac 2024, Sustainability: responsive images and modern formats](https://almanac.httparchive.org/en/2024/sustainability?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [W3C, Web Sustainability Guidelines: resize, optimise and compress media for different screens](https://www.w3.org/TR/web-sustainability-guidelines/#optimized-media)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/)

#### Key Facts

- Tip **#42**
- For **Developers**
- Category **Web and front-end**
- Format **short video**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
