Alt text is a short piece of writing that stands in for a picture. If someone can't see the picture, the alt text tells them what it's there for.
The name is short for alternative text. Section508.gov, a US government site, defines it as "descriptive text that conveys the meaning of an image in digital content".1
Where it lives
On a web page, an image is added with an <img> tag. That tag has a part called the alt attribute, and the alt text goes in it. Most website editors hide the code and give you a box labelled "alt text", "alternative text" or "image description". Whatever it's called, it fills in the same attribute.
The attribute isn't optional decoration. MDN, the web documentation run by Mozilla, calls it mandatory and says "screen readers read the attribute value out to their users so they know what the image means".2
Who relies on it
Screen readers are tools that speak the words on a page for people who can't read the screen. When one reaches a picture, it reads the alt text instead. WebAIM, an accessibility group, says screen readers announce the alternative text "in place of images".3
Without it, there's a gap. Section508.gov puts it flatly: "Without alt text, people who use screen readers cannot access the content provided in the images."1
Screen reader users aren't the only ones. The same guide says alt text also helps people who may find the visual content hard to understand, and people without access to high-speed internet who can't load images.1
Then there are plain old broken pictures. WebAIM says that if an image fails to load, or the visitor has blocked images, the browser shows the alternative text "visually in place of the image".3 MDN lists some causes: network errors, content blocking and link rot, which is when a file you linked to has gone.2
Software reads it too
WebAIM also says that search engines "use alternative text and factor it into their assessment of the page purpose and content."3 That's a side effect, though. Write for the person first.
Why can't software just work out what's in a picture? WebAIM's answer is that "algorithms alone cannot understand what an image means within the context of the overall page".3 Its example is a maple leaf. It might stand for Canada, or it might just be a leaf from a tree. Only you know which one you meant.
What this means for your pages
Alt text describes the job a picture does on your page. It isn't a caption, and it isn't a place for keywords.
Every picture on your site falls into one of a few kinds. Each kind gets different treatment.
- An ordinary photo or illustration that adds something: ordinary photos.
- A picture that's only there for looks: purely decorative pictures.
- A logo, an icon, or a picture that's a link or button: pictures that are links or logos.
- A chart or diagram: charts and diagrams.
- A picture containing words: pictures with words in them.
After those, read the common mistakes. Then see how to audit your own pages.
This site gives general information from the sources listed below. It isn't legal advice. If you need to know what rules apply to your business, check the official source for your country.
Sources used
- Authoring Meaningful Alternative Text, Section508.gov (US General Services Administration)
- <img>: The Image Embed element, MDN Web Docs (Mozilla)
- WebAIM: Alternative Text, WebAIM