In HTML, the alt attribute sits inside an <img> element and holds the text that stands in for the image:
<img src="trail-shoe.jpg" alt="Grey trail running shoe with a deep-lugged sole">
You'll often hear it called "alt text", or loosely the "alt tag", though it's an HTML attribute, not a tag. Every <img> should have one, even when its value is empty.
Who reads alt text
People using screen readers. A screen reader can't see the picture, so it reads the alt text out instead. Accessibility guidelines make this a basic requirement: WCAG success criterion 1.1.1 (Level A) asks that all non-text content has a text alternative that serves the same purpose. W3C
Everyone, when an image fails. If the image doesn't load, the browser may show the alt text in its place.
Search engines. Google uses alt text together with computer vision and the text of the page to understand what an image shows, and calls alt the most important attribute for image metadata. When an image is a link, Google uses its alt text as the link's anchor text. Google Search Central That makes alt text part of image SEO, but the reader comes first: alt that helps a person who can't see the image almost always helps search too.
What to write depends on the image's job
Ask what the image does on this page, then use this table, based on the W3C's alt decision tree:
| The image... | Write in alt |
|---|---|
| shows something the reader needs, like a product photo or a simple chart | a short description of what matters about it here |
| is a link or a button | where the link goes or what the button does: "Search", not "magnifying glass" |
| contains text that isn't anywhere else on the page | that text |
| is a complex chart or diagram | a short summary, with the full data in the page text nearby |
| is decoration, or repeats text right next to it | nothing: alt="" |
The same picture can need different alt text on different pages. Say a shop shows a photo of a trail shoe. On the product page, the alt describes the shoe: color, sole, the details a buyer cares about. In a "Shop trail shoes" link on the homepage, the alt should name where the link goes: "Shop trail running shoes".
For a chart, say what it shows rather than what it looks like. "Bar chart in blue and grey" tells the reader nothing; "Sales rose every quarter in 2025, from 120 to 210 orders" does. If the chart holds more than a sentence of information, put that information in the page text or a table.
Empty alt and missing alt are not the same
alt="" tells assistive technology that the image isn't part of the content, so it can be skipped. Use it for borders, background flourishes and icons placed next to text that already says the same thing.
Leaving the attribute out is different. Without any alt, some screen readers announce the image's file name instead, which might be "IMG_4021.jpg". MDN So always include the attribute, and leave it empty only on purpose.
Mistakes to avoid
- Stuffing keywords. A list of search terms in the alt attribute doesn't describe anything, and Google warns it may cause your site to be seen as spam.
- Using
titleinstead ofalt. The title attribute only shows on hover, and isn't a substitute. Don't repeat the alt in a title either, or some screen readers read it twice. - Describing the file, not the image. "hero-banner-final.png" and "image" help nobody.
- Writing an essay. Keep alt to the point. Long descriptions belong in the page text, where everyone can read them. The old
longdescattribute is obsolete in HTML, so don't rely on it. - Forgetting images in links. A linked logo or icon with empty alt leaves the link with no name at all.
How to check your pages
Look for <img> elements with no alt attribute, and for linked images whose alt is empty. Browser developer tools, accessibility checkers and SEO crawlers can all list them. Then read the alt texts you do have out of context, one by one: would each make sense to someone who can't see the page?