How to write and fix image alternative text
Alternative text is the short text equivalent of an image. When it is missing, a screen reader may say "image" or read a file name. When it is written carelessly, it can be just as unhelpful. The goal is not to describe every pixel. The goal is to give the person the same information or function the image provides to someone who can see it.
This guide follows WCAG 2.1 Success Criterion 1.1.1 (Non-text Content). It is general information, not legal advice.
The main rule: describe the purpose
Ask, "If this image disappeared, what would I need to say in its place?" That answer is usually the alternative text.
- A product photo should help someone choose the product.
- A search button that is only an icon should say "Search."
- A decorative flourish should be skipped.
Missing alt versus empty alt
There is an important difference:
- No
altattribute at all is a failure for images that need a text alternative, and it often causes the file name to be read. alt=""(empty) tells assistive technology to skip a decorative image. That is the correct choice when the image adds no information.
<img src="hero-curves.svg" alt="">
<img src="blue-mug.jpg" alt="Blue ceramic mug with a white handle, shown from the side">
In HTML, role="presentation" is not a substitute you should rely on for content images. Use empty alternative text for decorative images, and real alternative text for the rest.
Decorative images
Background shapes, dividers, and stock photos that are purely atmospheric can take empty alternative text, as long as no information is lost. If the same photo is the only way a visitor knows you have a lakeside patio, it is not decorative.
Informative images
Photos, illustrations, and diagrams that add meaning need a short, honest description. You do not need "image of" or "photo of" at the start. The screen reader already knows it is an image.
Good: A golden retriever sleeping on a porch swing. Weak: image.jpg or dog.
Functional images and linked images
If the image is the control, the alternative text should name the action or the destination, not the artwork.
<a href="/">
<img src="logo.svg" alt="ADA Comply Guy home">
</a>
If the link already has visible text next to the image, do not repeat it in the alternative text. Give the image empty alt or hide it, so the link is not announced twice.
Product photos
On a product page, mention the item, the color or material, and any important visible features. You do not need to repeat the price or the full marketing paragraph if that text is already on the page. In a category grid, a short name is often enough if the adjacent text already has the product name; if the image is the only name, the alternative text has to carry it.
Avoid auto-generated text like sku-4491-a.jpg.
Logos, icons, and images of text
A logo used as the home link should include the company name. An icon-only social link should name the destination: "ADA Comply Guy on Facebook," not "f."
If the image is a picture of words — a sale banner, a slogan, a menu — the alternative text should include those words, unless the same words are already in the page as real text. Real text is almost always better than a picture of text, because it can be enlarged and translated more reliably. That idea also appears in WCAG 1.4.5.
Charts and graphs
A chart needs a short alternative that states the point of the graphic, and usually a longer equivalent as well: a data table, a summary paragraph, or both. alt="sales chart" is not enough. alt="Bar chart showing sales rising from $20,000 in January to $45,000 in June" is a start, with the numbers also available in a table.
How to write it well
- Be specific and brief. One short sentence is usually plenty.
- Match the context. The same photo may need different text in a news story and in a staff directory.
- Do not stuff keywords.
- Do not repeat a visible caption word for word if the caption is already tied to the image.
- Do not put empty alternative text on a button, a logo link, or any image that is the only way to understand an action.
A short review checklist
- Find every
img(and meaningful CSS background image that is the only content of a control). - Confirm each one has an
altattribute, even if it is empty. - Listen to the page with a screen reader. Does each image make sense in order?
- Check product galleries, banners, icons, and logos, not only the article photos.
- Open any image-heavy PDFs too; they have their own tagging needs.
Notes for common platforms
WordPress. Fill in the Alternative Text field in the media library, and require it in the editorial workflow. Featured images need it as well.
Shopify. Theme product images should not fall back to the file name. Check collection pages and metafield-driven images, not only the main product image.
Webflow. Set Alt Text on each image asset. Background images in a layout may need an off-screen text equivalent if they carry meaning.
React. Always pass an alt prop. For decorative images, pass alt="", explicitly, so it is not forgotten.
Related reading
- The most common website accessibility problems
- Ecommerce product images
- Media and publishing
- WCAG 2.1 AA checklist
If you want help reviewing the images on a small-business site, text me at 910-931-0978 or visit my resources page.