How to supply retina artwork for a fixed-size icon
Answer in brief
For an icon with a single CSS size, provide density candidates in srcset. Each candidate should contain the same composition and differ only in pixel dimensions.
Build a 20-pixel pencil
Export a 20-pixel pencil and a 40-pixel pencil. Use the smaller file for src, list the larger one with a 2x descriptor, and set the displayed dimensions to 20 by 20. Inspect currentSrc with a high-density screen profile.
Find a density mismatch in the export
A file called pencil@2x.png can still contain only 20 pixels. Open its properties in an image editor and measure the canvas. At a 20 CSS pixel display width on a 2x device, a 40-pixel file gives two source pixels per CSS pixel along each axis.
Sources
- [1] HTML Standard — WHATWG, accessed November 23, 2026
Frequently asked questions
Will the browser always choose the largest file?
The browser chooses a candidate using its environment and preferences. Check the selected URL on the device you are diagnosing.