Not all images need alt text

Adding alt text to images is the no-brainer way to improve the accessibility of your text. However, you don't need alt text in every image.

Run any accessibility testing tool on your webpages and it will almost always come up with an "Image does not have alt text" error. But we can use null alt text and no title attribute to indicate to Assistive Technology(AT) that the image can be safely ignored. This is mainly used in cases where the image does not add any extra value to the content on the page.

An example of this is when an image is used to add a decorative element to the page.

<img src = "decorative-element.gif" alt = "">

There is a difference between having no alt tag and having an empty alt tag. Having no alt tag will always trigger errors in accessibility scan tools but having an empty or null alt tag will cause the image to be ignored by AT.

You can also apply this principle to an image that is used as a link, when there is an adjacent link that already has the link information.

<a href = "adifferentpage.html">
  <img src="link-image.jpg" alt = "">
  <span> Link to a new page </span>
</a>

In the case above, adding alt text will be redundant information since the adjacent span tag already has information about the link.

Read more about null alt text in the w3c blog. Source: https://www.w3.org/WAI/WCAG21/Techniques/html/H67