How to fix "Images must have alternative text"
A screen reader cannot see an image. If the img has no alt attribute, most screen readers fall back to reading the file name, so a visitor hears "I M G underscore 4 4 7 1 dot J P G". This is the single most common accessibility failure on the web and it fails WCAG 1.1.1.
Decide what kind of image it is
- It carries information (a product photo, a chart, a team portrait). Describe what matters in this context, in under about 125 characters.
- It is the only thing inside a link or button (a logo linking home, a cart icon). Say where the link goes or what the button does, not what the picture looks like.
- It is decoration (a divider, a background flourish, an icon next to text that already says the same thing). Give it an empty alt so screen readers skip it.
<img src="sea-salt-candle.jpg" alt="Sea Salt candle in a clear glass jar">
<a href="/"><img src="logo.svg" alt="Harbor Candle Co. home"></a>
<img src="divider.png" alt="">
Common mistakes
- Leaving the attribute out is not the same as
alt="". Missing means "unknown"; empty means "skip this". - Do not start with "image of" or "picture of". The screen reader already announces that it is an image.
- Do not put the same alt on every product in a grid. In a template, use the product's own title, for example
alt="{{ product.title | escape }}"in Shopify Liquid. - Do not mark an image decorative when it is the only content of a link. The link would then have no name at all.
Check your own site
Our free scanner loads your pages in a real browser and lists every failure like this one that automated testing can detect. Scan a site.