---
title: "How we improved image download sizes on Medium with just four characters"
description: "Adding \"auto\" to the sizes attribute of lazy-loaded images lets the browser pick the best srcset candidate from the actual layout, with no hand-written breakpoint rules."
url: "https://swe.quest/articles/how-we-improved-image-download-sizes-on-medium-with-just-four-characters-a3d2c25702a3ec03"
canonical: "https://medium.engineering/how-we-improved-image-download-sizes-on-medium-with-just-four-characters-9621b0ebb291"
source: "Medium Engineering"
published: "2026-05-18"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["web-performance","browsers","frontend"]
---

# How we improved image download sizes on Medium with just four characters

A post on [Medium Engineering](https://swe.quest/sources/medium-eng.md), published 2026-05-18, 7 min read, How-to. Original: [https://medium.engineering/how-we-improved-image-download-sizes-on-medium-with-just-four-characters-9621b0ebb291](https://medium.engineering/how-we-improved-image-download-sizes-on-medium-with-just-four-characters-9621b0ebb291)

## Summary

Adding "auto" to the sizes attribute of lazy-loaded images lets the browser pick the best srcset candidate from the actual layout, with no hand-written breakpoint rules. Medium saw roughly 7% smaller image downloads on its home feed on some displays. The explanation covers why \<picture\>, srcset and sizes exist: browsers fetch images before layout, so sizes must otherwise be hand-calculated. Unsupported browsers ignore the unparseable "auto" token, so the change is backwards compatible, and WordPress has already adopted it.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Web performance](https://swe.quest/tags/web-performance.md) (Web & mobile)
- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)

## Prerequisites

- HTML img element
- responsive images basics

## Keywords

srcset, sizes=auto, loading=lazy, picture element, WebKit, Gecko, WordPress

## Related posts

- [Squarespace & Web Standards: How We Helped Bring HTML Video & Audio Lazy Loading to Today’s Browsers](https://swe.quest/articles/squarespace-web-standards-how-we-helped-bring-html-video-audio-lazy-loading-to-ca2932e3c3919622.md): Squarespace Engineering · 2026-03-30 · Easy · 11 min read · Browsers, Web performance, Video & media, Open source
  Squarespace engineers proposed and landed loading="lazy" for HTML \<video\> and \<audio\> in the WHATWG HTML Standard (merged March 23, 2026).
- [How To Use Standard HTML Video & Audio Lazy-Loading on the Web Today](https://swe.quest/articles/how-to-use-standard-html-video-audio-lazy-loading-on-the-web-today-e65b737aa3473734.md): Squarespace Engineering · 2026-04-07 · Medium · 8 min read · Web performance, Browsers, Frontend
  HTML \<video\> and \<audio\> elements now accept the same loading="lazy" attribute as images and iframes, deferring media, poster images and even autoplay until the element is visible near the viewport.
- [Bun v1.3.14](https://swe.quest/articles/bun-v1-3-14-a83f03d287060048.md): Bun · 2026-05-13 · Medium · 50 min read · JavaScript, Runtimes & VMs, Networking, Build systems, Performance engineering
  Bun v1.3.14 adds Bun.Image, a built-in, sharp-compatible image pipeline that benchmarks 1.2–1.4× faster than sharp on resize/encode thanks to fixed-point SIMD resize kernels and JPEG IDCT downscaling.
- [Build a Simple Image Resizing API in less than 100 LOC](https://swe.quest/articles/build-a-simple-image-resizing-api-in-less-than-100-loc-5c6fb2fd73d43c52.md): Deno · 2023-02-08 · Medium · 6 min read · TypeScript, WebAssembly, Serverless, API design
  An HTTP image resizing API built on Deno uses imagemagick\_deno, ImageMagick compiled to WebAssembly, and fits in under 100 lines of TypeScript.
- [Bun v1.1.21](https://swe.quest/articles/bun-v1-1-21-557c16e13cb74793.md): Bun · 2024-07-27 · Medium · 11 min read · JavaScript, Runtimes & VMs, Performance engineering, Build systems
  Bun v1.1.21 fixes 72 bugs and speeds up gzip/deflate decompression in fetch() by 30% on Linux x64 by switching to libdeflate, which also speeds up the WebSocket server.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
