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

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

## 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)

### Transcript

That four-thousand-pixel photo is shown four hundred pixels wide. Many pages send one big original image to every device. Then the browser shrinks it to fit. A phone downloads many times the pixels it can show. Every pixel sent but never seen wastes data and battery. Here is the fix you can use today. Make several widths of each image, at build time or through an image service. Use srcset and sizes, so the browser picks the nearest size. In your page check, look for images much bigger than their display size. Tools like Lighthouse and WebPageTest flag heavy images and show every request's size. The Green Software Foundation suggests serving images at the size they are shown. GreenCode draws on these patterns when it checks software. GreenCode helps tackle this by practising it on its own site. Its home page fell from six point eight to one point seven megabytes. That was GreenCode Tech Tip number forty-two. Follow for the next tip, and find more on greencode.ai/tech-tips.

[The tip in full](https://greencode.ai/tech-tips/42-size-images-for-the-screen/)

[« Tech Tip #41: Optimise what runs everywhere](https://greencode.ai/shorts/41-install-base-is-the-multiplier/)[Tech Tip #43: Consolidate underused servers »](https://greencode.ai/shorts/43-consolidate-underused-servers/)

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

#### Key Facts

- Tip **#42**
- For **Developers**
- Length **1:06**
- Category **Web and front-end**
![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/)
