{"canonical_url":"https://engineer.company/glossary/responsive-images/","content_markdown":"# Responsive images\n\n## What it is\n\nResponsive images let a browser choose a suitable image resource for the place a\npicture occupies. A small screen may need fewer pixels than a large one, and a\nhigh-density display may need more than a standard-density display of the same\nlayout size. The page can describe its available resources and the expected\ndisplay conditions so the browser can select one that fits.\n\nHTML provides several ways to express the choices. A `srcset` list can associate\ncandidate files with widths or pixel-density descriptors. A `sizes` attribute\ncan describe an expected layout slot when width descriptors are used. The\nbrowser uses this information along with its actual conditions. A picture\nelement can also provide a different crop for a particular layout or offer a\ndifferent encoding supported by the recipient.\n\nImage dimensions are another part of the design. Accurate width and height\ninformation can help the browser reserve space before an image arrives. The\ndisplayed size can still respond to CSS. Verify the relationship between the\ndeclared dimensions, the resources' actual pixels and the layout, especially\nwhere a page uses crops of different shapes.\n\n## Why it matters\n\nSending the largest available photograph to every visitor can increase download\ntime and data use. Sending a small version everywhere can make an important\nimage blurry when it is displayed larger or at higher density. The site can\noffer useful choices and let the browser pick among them. Verify the browser’s\nactual choice at different viewport widths, display densities and cache states.\n\nDifferent layouts can change the image's slot in ways the viewport width alone\ndoes not explain. A wide desktop page might give an image only part of its width\nin a grid. A narrower layout can place the same picture across a whole column.\nAn inaccurate sizes declaration can cause the selected resource to be larger or\nsmaller than the layout needs. Derive it from the component's actual\nbreakpoints.\n\nArt direction is a separate decision about what the reader sees. A portrait on a\nsmall screen may need a tighter crop if the full scene makes the important\nperson too small. The crop still needs to preserve what the image contributes,\nand its text alternative should keep that meaning. Inspect the resource and\ncomposition together at the layout where people see it.\n\n## What it looks like in practice\n\nImagine a portrait in a profile and on a wide article page. Measure the display\nslot in each use. Generate smaller derivatives that preserve the intended crop\nand enough candidates for the display densities the product cares about. Use an\nordinary image fallback and supply the expected sizes for the width-based\ncandidates. Check that the decoded image looks sharp at the actual rendered\nsize.\n\nMake the network test part of the review. In a fresh browser at a small\nviewport, observe the selected resource and measure the slot. Repeat at the same\nwidth with a higher-density setting and then at a wider layout. A warm cache can\naffect which resource the browser reuses, so exercise a return visit separately.\nRecord the resource dimensions, content type and bytes next to the captured\nresult.\n\nEngineer's\n[stylesheet and asset delivery case study](/portfolio/cut-the-stylesheet-bundle-from-87-kb-to-31-kb/)\nrecords a trial of a modern format for the brand mark. The trial file was\nlarger, so the site kept the existing format. The same case describes checking\noriginal pixel dimensions against the actual display size. Measure the selected\nfile, its bytes and its appearance under the conditions readers use to see\nwhether each candidate should be offered.\n\nInclude the initial layout before the image has decoded. Reserve the correct\nproportions and look for a later shift. If the portrait moves between a sidebar\nand a wide column, test both placements and ensure the metadata describes the\nresource used in each.\n\nWhen the image belongs at the top of an article, check how early the browser\nfinds it and whether the page defers it. A below-the-fold gallery and an opening\nportrait can have different loading policies while sharing the same\ncandidate-generation pipeline. Compare the initial page request, the moment the\nfirst photograph appears and the downloads caused by scrolling. Repeat in a\nrealistic connection profile, since a large resource that arrives instantly from\nthe local cache can mask a substantial cost on the first visit. Keep the loading\npriority decision close to the image's role so it stays correct when the layout\nmoves.\n\n## Where it goes wrong\n\nIf the sizes value describes the full screen, the browser can fetch an\nunnecessarily large resource for an image in a narrow column. Compare the\nexpected and measured widths around layout changes. Keep the media conditions in\nthe markup aligned with the CSS, or use a design that makes the slot clear\nthrough a supported default.\n\nA resource can also declare an inaccurate width or contain a crop different from\nwhat the layout assumes. Verify the actual dimensions of the files offered. If a\ncandidate was resized from a smaller master, it can use more bytes without\nimproving detail. Check the delivered pixels at the native sizes and densities\nthat motivated the candidate.\n\nFinally, review the whole image experience. A picture can have correct network\nbehaviour while its crop loses an important detail, its reserved area is\ninaccurate, or its alternative no longer describes the visible subject. A useful\nresponsive image delivers appropriate bytes, leaves the layout stable and\npreserves meaning across the contexts in which it appears.\n\n## Further reading\n\n- [The HTML Standard on viewport-based image selection](https://html.spec.whatwg.org/multipage/images.html#viewport-based-selection).\n  Describes srcset and sizes for responsive slots.\n- [Chrome's web.dev guide to descriptive image choice](https://web.dev/learn/images/descriptive).\n  Explains how candidate widths and densities are described.\n- [Chrome's web.dev guide to prescriptive picture sources](https://web.dev/learn/images/prescriptive).\n  Covers art direction and format selection.\n\n\u003chttps://engineer.company/glossary/responsive-images/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"Offer suitable image sizes and crops, inspect the resource that the browser loads and check whether the layout stays stable.","formats":{"gemtext":"https://engineer.company/glossary/responsive-images/index.gmi","gopher":"https://engineer.company/glossary/responsive-images/gophermap","html":"https://engineer.company/glossary/responsive-images/","json":"https://engineer.company/glossary/responsive-images/index.json","markdown":"https://engineer.company/glossary/responsive-images/index.md","pdf":"https://engineer.company/glossary/responsive-images/index.pdf"},"kind":"page","language":"en","title":"What are responsive images?","url":"https://engineer.company/glossary/responsive-images/","version":1}