Skiplink

Guides

Image alt text: what the image-alt rule catches and what it cannot judge

Missing alt text is one of the most common violations a scanner finds, and one of the easiest to fix badly. The rule can tell you an image has no text alternative. It cannot tell you whether the one you add is any use.

What the rule checks

axe-core's image-alt (opens in a new tab) rule maps to 1.1.1 Non-text Content (opens in a new tab), level A. It reports an <img> that has no text alternative and has not been marked as decorative. An image passes if it has any of:

An alt made only of spaces is reported, because it is neither a description nor a clear signal that the image is decorative.

Other rules cover other kinds of image, all mapped to 1.1.1: input-image-alt for <input type="image">, svg-img-alt for an <svg> with role="img", role-img-alt for other elements with role="img", object-alt for <object>, and area-alt for image map areas. Images used as CSS backgrounds are not checked at all; if one carries information, it needs a text alternative somewhere else.

Before and after

<!-- Fails: no alt at all. A screen reader may read the file name instead. -->
<img src="https://cdn.example.com/img/IMG_4471.jpg">

<!-- Passes, and is useful -->
<img src="https://cdn.example.com/img/IMG_4471.jpg"
     alt="Two volunteers loading food parcels into a van outside the warehouse">

Without alt, many screen readers fall back to announcing the src. "IMG underscore 4471 dot jpg" is worse than silence.

Three kinds of image, three kinds of alt

Informative images carry content. Write what the image tells the reader in this context, not everything in it. The same photo of a building might be "Our office on Tariff Street" on a contact page and "Brick warehouse with the original 1890s loading doors" in an article about the renovation.

Functional images are inside a link or button. The alt is the name of the control, so describe where it goes or what it does, not what it looks like:

<!-- Before: describes the picture -->
<a href="/"><img src="https://cdn.example.com/logo.svg" alt="Green leaf logo"></a>

<!-- After: describes the destination -->
<a href="/"><img src="https://cdn.example.com/logo.svg" alt="Northwind home"></a>

Decorative images add nothing a reader would miss: a flourish, a background texture set as an <img>, an icon next to text that already says the same thing. Give them an empty alt so assistive technology skips them:

<p><img src="https://cdn.example.com/icons/phone.svg" alt=""> 0161 496 0000</p>

Leaving alt off is not the same as alt="". Missing means "nobody decided"; empty means "decided, and there is nothing to say". Only the second passes.

The W3C's alt decision tree (opens in a new tab) walks through these cases, and a few rarer ones, in about a minute per image.

Some details that trip people up

MDN's page on the img element (opens in a new tab) covers the attributes in more depth.

What the rule cannot judge

Every one of these passes image-alt:

<img src="https://cdn.example.com/team.jpg" alt="image">
<img src="https://cdn.example.com/chart-q3.png" alt="chart">
<img src="https://cdn.example.com/product-42.jpg" alt="product-42.jpg">
<img src="https://cdn.example.com/hero.jpg" alt="">   <!-- but the image is the only place the offer appears -->

The rule checks that a text alternative exists, or that the image has been explicitly marked as decorative. Whether the text describes the picture, and whether a decorative image really is decorative, needs someone who can see the image and understands why it is on the page. As our page on what a scan does not tell you puts it, an image with alt="image" passes every automated check and helps nobody.

That gap is also why gating on the rule has a side effect worth watching: under deadline, the quickest way to clear an image-alt failure is to type anything at all into the alt. Review alt text in code review the way you review copy, and treat a sudden drop in image-alt findings across a template as something to read, not just to celebrate.

Where this leaves a scan

Missing alt is cheap for a scanner to find and, on a site with a shared template, often accounts for hundreds of findings from a single cause. Fix the template and they all go. What remains is editorial work: a person reading each image in context. The criteria table shows what a scanner can see across the perceivable criteria, and which of them it cannot see at all.

Try it on your own site: scan a URL for free, or read the docs to add a baseline to your pipeline.