Skip to content

Image without a text alternative

a11y-image-altcritical
On this page

Why it matters

  • People who cannot see an image hear its text alternative instead. Without one, a screen reader may skip the image, or read its file name, such as «IMG_2034.jpg», which tells them nothing.
  • WCAG 2.2 asks for a text alternative for every image that carries information (success criterion 1.1.1, level A).
  • Google reads the text alternative to understand what an image shows.

Example

Wrong
<img
  id="product"
  src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEklEQVR4nGP4z8CAFWEXHbQSACj/P8Fu7N9hAAAAAElFTkSuQmCC"
  width="160"
  height="160"
/>
Right
<img
  id="product"
  src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEklEQVR4nGP4z8CAFWEXHbQSACj/P8Fu7N9hAAAAAElFTkSuQmCC"
  alt="زجاجة عطر العود الملكي"
  width="160"
  height="160"
/>

How to fix

  • Add an alt that says what the image shows or does, in the page's language: <img src="oud.jpg" alt="زجاجة عطر العود الملكي، 50 مل">.
  • For an image that only decorates, write an empty alt="", so screen readers pass over it.
  • For an image that is a link or a button, say where it leads or what it does: alt="السلة".

How we detect

  1. We render the page and run axe-core 4.13.0, the open-source accessibility engine by Deque, with its image-alt rule, in each engine.
  2. The rule reports each image without a text alternative: no alt, aria-label or aria-labelledby, and not marked as decorative with alt="" or role="presentation".
  3. It does not apply to pages without images.