What is alt text — and why the same image needs different alt on different pages

Here's a strange one. You have a photo of a bird on a branch. Put it on a site about city parks and the right description is "a bird on a branch." Put the exact same photo on a site about birds, and the right description becomes "a male chaffinch with a rust-coloured breast."
Same file. Same pixels. Different alt text.
This isn't theorists nitpicking — it's the rule everything else follows from. And it's exactly what the model writing your alt text for you doesn't know.
What alt text is
alt is an HTML attribute on an image where you put a text replacement for it. Like this:
<img src="park.jpg" alt="A bird on a branch">
That text never appears on screen if the image loads. But three parties read it:
- A screen reader — it speaks the alt instead of the image to someone who can't see it.
- A search crawler — it's the only way for it to know what's in the picture.
- The browser, when the image never arrives: slow connection, broken link, blocked domain. Instead of an empty rectangle, the person gets text.
So alt isn't a checkbox for an audit. It's what your image becomes when it can't be seen.
The rule that decides everything: alt describes the role, not the pixels
W3C puts it plainly: the text alternative depends on the usage, context and content of an image — in that order. Same bird: on a park site its species barely matters, on a birding site the species is the point.
Icons make it even clearer. You put an envelope image inside a button:
<button><img src="envelope.svg" alt="..."></button>
The temptation is alt="envelope". But a screen reader user hears "button, envelope" and is left guessing. The right answer is alt="Contact us": for a functional image, alt describes the action or destination, not the picture.
Quick test: cover the image with your hand and read aloud what you're about to put in alt. If the page still makes sense, you got it right.
Four kinds of images, and what to write for each
- Informative — carries meaning the surrounding text doesn't. A diagram, a product photo, an error screenshot. Write a short phrase carrying that meaning:
alt="Error 404 on the checkout page". - Functional — an image inside a link or button. Describe the action:
alt="Open cart", oralt="Go to homepage"for a logo that links home. - Decorative — a background, a divider, an abstract shape "for looks." The right answer is an empty
alt="". - Complex — a chart, a diagram, an infographic. Only a title fits in alt ("Revenue growth in 2026"); the actual data belongs in text or a table on the page.
There's a fifth case: an image that duplicates text right next to it. A cart icon beside the word "Cart." Empty alt="" again, or the person hears "cart cart."
Empty alt isn't laziness — it's a tool
This is where beginners most often go wrong, and it's counterintuitive.
alt=""— the screen reader silently skips the image. You deliberately said: nothing to see here, move on.- No attribute at all — the reader doesn't know what to do and announces what it has: the file path. The person hears "image, slash, assets, hero-banner-final-two-dot-p-n-g."
The difference between silence and fifteen seconds of garbage is two characters of code.
Also: don't start with "Image of…" or "Photo of…". The screen reader already announces it's an image. You'd get "image, image of a cat."
Why AI writes bad alt text (and what to do about it)
A model generating alt from an image sees exactly what's in the pixels. It doesn't know why that image is on this page: it hasn't read your paragraph beside it, doesn't know the icon sits inside a button, doesn't know the photo is just a backdrop. So it honestly describes the picture — when what was needed was the role.
That's not a guess: the independent accessibility industry fact sheet lists automated text alternatives among the things that don't work reliably, alongside form labels and focus management.
The workable pattern: let AI write a draft, then spend five seconds on "what role does this image play here?" For decorative ones, use empty alt without hesitation. As a bonus, the same alt is read by search crawlers, so careful descriptions also help your SEO — a nice side effect, but not a reason to write them.
Does every image need alt?
The attribute, yes. The text inside, no: decorative images specifically need an empty alt="". A missing attribute and an empty attribute are two different things.
How long should alt text be?
As short as it can be while carrying the meaning. W3C's guidance is a phrase or a single sentence. If you need more, the image is complex — put its content into the page as text.
How do I check my alt text is decent?
Open the page and disable images in your browser (or just look at its structure in developer tools). Whatever is still readable is what a person using a screen reader gets. Blank spots where buttons should be are your to-do list.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





