WCAG requires all images to have alternative text to convey their purpose and meaning to users who rely on screen readers.
Without alternative text, screen readers have no way to explain an image to a user. Users who cannot see won’t understand images in relation to your content without the necessary alt text, creating a frustrating experience.
Developers need to ensure all <img> elements have short, descriptive alternate text and all decorative <img> elements have empty alt attributes (e.g. alt=””).
There are three main ways to add alternate text to an image:
Alt text should relay the purpose of an image to a user, so it should be clear and useful. For decorative images that do not require alternative text, provide “null” alt attributes (using alt=””). This tells screen readers to ignore an image.
For more examples, visit W3C’s GitHub’s ATC Rules library.