Alt text is the short description of an image that people hear when they can't see it. It's one of the oldest accessibility features on the web, and one of the most often missed. Here's what it does, how to write it, and when to leave it empty.
Alt tag, alt attribute or alt text?
They all mean the same thing. Strictly, alt is an attribute of the <img> tag,
not a tag of its own, and the description you put in it is the alt text:
<img src="team.jpg" alt="Our five-person team outside the bakery">
You'll rarely type that yourself. Website builders and content management systems have a field for it, usually called "Alt text" or "Alternative text", next to the image when you upload or insert it.
What it's for
- Screen readers: people who are blind or have low vision hear the alt text read out where the image is.
- Broken images: when an image doesn't load, on a slow connection or because the file is missing, the browser shows the alt text in its place.
- Search engines: Google uses alt text, along with the text around an image, to understand what it shows and when to show it in image search.
It's also required. WCAG success criterion 1.1.1 Non-text Content, at level A, asks for a text alternative for every image that carries meaning.
How to write good alt text
Ask yourself what you'd say about the image if you were reading the page aloud to someone over the phone. That's your alt text.
- Say what matters here. The same photo can need different alt text on different pages. On a menu page, "Sourdough loaf with a dark, crackled crust" describes the bread. On an about page, the same photo might be "Our head baker's first loaf of the morning".
- Keep it short. A sentence or less is usually enough. People can't skim alt text, they have to listen to all of it.
- Skip "image of" and "picture of". Screen readers already announce that it's an image.
- Include any text in the image. If the image shows words, like a sale banner or a quote, the alt text should say them.
- Don't stuff keywords. Alt text written for search engines instead of people is worse for both.
Images that are links or buttons
When an image is the only thing inside a link or a button, its alt text becomes the link or button's name. Describe where it goes or what it does, not what it looks like. A logo that links to your home page should have alt text like "Home" or your business name, not "Logo". A magnifying glass on a search button should be "Search".
Decorative images
Some images add nothing a listener would miss: a divider, a background texture, a photo beside a heading that
already says the same thing. Give these an empty alt attribute, alt="", and screen
readers skip them.
Empty isn't the same as missing. When an image has no alt attribute at all, screen readers may read out its file name instead, so "IMG underscore 4021 dot JPG" is what your visitor hears.
Charts, diagrams and other complex images
A chart can hold more than a sentence can say. Give it short alt text that says what it is and its main point, like "Bar chart: online orders doubled between March and June", and put the details in the text on the page, or in a table beside it, where everyone can read them.
What alt text can't do
- The title attribute isn't a replacement. It shows as a tooltip when someone hovers with a mouse. Screen readers don't reliably read it, and touch screens can't show it.
- CSS background images can't have alt text. If an image carries meaning, put it on the page as an image, not as a background.
- Icons drawn with SVG or icon fonts need a different approach. They
don't have an alt attribute, so they're named with
aria-labelinstead. See What is aria-label?.
How Bloomlight helps
Bloomlight's accessibility audit flags every image on your key pages that's missing an alt attribute, and every link or button with no name a screen reader can announce. Each one becomes a finding that shows you where it is on the page. Writing the alt text is still up to you: only you know what each image is there to say.