
How to Write Alt Text for Screen Readers and AI Search
Write alt text that screen readers and AI crawlers both understand: what to describe, how long to make it, when to leave it empty, and how to check it.
To write alt text that works, describe what an image shows and what it does on the page in a short, specific phrase, without keyword stuffing or repeating the text around it. That one description serves two readers at once: a screen reader user who can't see the image, and an AI crawler like GPTBot or Googlebot trying to work out what your page is about.
Get it right and you meet WCAG's requirement for images while handing search and answer engines a clean, accurate description of your content. Get it wrong and the image either drops out for assistive technology users or gives machines a description that doesn't match the picture.
The problem is widespread. The WebAIM Million, an annual automated scan of the home pages of the top one million websites, lists missing alternative text among the six most common types of errors it detects. Image-heavy sites, like real estate listings, ecommerce catalogs, and portfolios, simply have more chances to get it wrong.
What is alt text, exactly?
Alt text is the value of the alt attribute on an <img> element. Screen readers read it aloud, browsers display it when an image fails to load, and search engines and AI models parse it to understand images they can't literally see.
Here's the baseline markup:
<img src="golden-retriever-park.jpg" alt="Golden retriever catching a frisbee in a park">
The rule behind it is WCAG Success Criterion 1.1.1 Non-text Content: every image that conveys something needs a text alternative that serves the equivalent purpose. That means not a caption and not a keyword list, but a functional description that lets someone who can't see the image understand what it's doing on the page. You can read the exact wording in the WCAG quick reference.
The markup is simple. The words inside those quotes carry the weight: for compliance, for usability, and for how answer engines understand and describe your page.
How do you write alt text that actually works?
Start by asking what job the image is doing on the page. Most images do one of four jobs, and each one needs a different kind of text alternative:
- Informative images show content the reader needs. Describe that content:
alt="Golden retriever puppy chewing a red rubber ball on grass", notalt="IMG_4821". - Functional images are links or buttons. Describe the action, not the icon. A magnifying glass that submits a search form gets
alt="Search", notalt="Magnifying glass icon". - Decorative images, such as dividers, background flourishes, and stock photos that add nothing informational, get an empty
alt=""so screen readers skip them. - Complex images, such as charts, infographics, and diagrams, need a short alt plus a full text equivalent elsewhere on the page, because one attribute can't carry that much information.
Once you know the job, a few rules hold up across almost every case:
- Describe function before appearance. If an image is a link or a button, say where it goes or what it does. "Search icon" is weaker than "Search this site."
- Be specific, not generic. "Woman at desk" tells a screen reader user almost nothing. "Woman reviewing tax documents at a laptop" tells them what's happening and why the image is there. A team photo reads better as "Maria Chen, Chief Financial Officer, standing in front of a bookshelf" than as "headshot.jpg."
- Describe substance, not style. "A beautiful, vibrant photograph" describes nothing concrete. Neither a person nor a machine can do anything with it.
- Skip the redundant phrases. Don't start with "image of" or "picture of." Screen readers already announce that it's an image, so saying it again just wastes the listener's time.
- Match the purpose of the page. A product image on an ecommerce site should mention the color, material, or features a shopper cares about: "Charcoal wool peacoat with brass buttons," not "Coat." A real estate photo works better as "Two-story brick colonial with attached garage and covered front porch" than as "House."
One mistake is especially easy to make: treating alt text like a caption. It isn't one. A caption, usually inside a <figcaption> element, sits next to the image and adds context, credit, or commentary for everyone. Alt text replaces the image for someone who can't see it at all. When you use both, give them different jobs. If your alt text repeats the caption word for word, a screen reader user hears the same sentence twice and learns nothing new.
How long should alt text be?
As long as it needs to be to do the image's job, and no longer. WCAG doesn't set a character limit for alt text, so length is a judgment call, not a rule. For most images that means a short phrase or a single sentence, and one or two sentences is almost always enough.
A quick test: read the alt text aloud with the image hidden. If the sentence makes sense and tells you what you'd otherwise miss, it's long enough. If you find yourself writing a paragraph, the image is probably complex.
Picture a nonprofit's infographic with every statistic crammed into a single alt attribute. A screen reader user has to sit through all of it in one go, with no way to skim or jump back to a figure. The better pattern is a short alt that names the image, with the details in real text beside it:
<!-- Too much for one attribute -->
<img src="donor-infographic.png" alt="Infographic showing donations by year, with monthly donors giving the largest share, followed by one-time donors, then corporate matching, then event revenue, then...">
<!-- Short alt, details in real text below the image -->
<img src="donor-infographic.png" alt="Infographic: donations by donor type, 2021 to 2025. Details below.">
Short and specific beats long and exhaustive. Anything that needs more than a sentence or two belongs in a text alternative on the page, which the section on charts and infographics covers below.
Does every image need alt text?
Every <img> needs an alt attribute, but not every one needs words in it. Purely decorative images, such as a divider graphic, a background texture, or a stock photo that adds nothing informational, should use an empty attribute:
<img src="divider-wave.svg" alt="">
That tells screen readers to skip the image instead of announcing a meaningless file name like "IMG_4021.jpg."
The mistake to watch for is the opposite: leaving the alt attribute off entirely instead of setting it to empty. That fails WCAG 1.1.1 even for a decorative image, because without the attribute, some screen readers fall back to reading the file path aloud. "Slash images slash banner dash final dash v2 dot jpg" isn't an experience anyone wants. If a scan has flagged images like this on your site, the missing alt text fix guide walks through the fix with copy-paste examples.
Background images set with CSS are a separate case. They can't take an alt attribute at all, so screen readers and crawlers get nothing from them. That's fine for a purely decorative texture. But if a CSS background carries meaning, such as a product photo, a chart, or text baked into a banner, either make it a real <img> with alt text or put the same information in visible text on the page.
So the real rule is simple: every image element gets an alt attribute, and whether that attribute has text in it depends on whether the image conveys information.
How is alt text different for SEO and AI search versus screen readers?
Mostly, it isn't, and that's the good news. The same descriptive, specific alt text that helps a screen reader user also helps Google understand what an image shows, and helps AI systems like ChatGPT or Perplexity pull accurate context from your page. There's no separate "SEO version" you need to write.
What AI search engines do with alt text
AI crawlers can't reliably look at every image the way a person does. Most lean on text signals instead: the alt attribute, the caption, the surrounding copy, and nearby headings. Some AI systems can run vision models on images, but you can't count on that happening for your page, so alt text is the signal to get right.
What changes between audiences is the failure mode. A screen reader user who hits bad alt text gets frustrated and may leave. An AI crawler that hits missing alt text has nothing to work with, so whatever the image shows never becomes part of what the system knows about your page. If it guesses instead, the guess can be wrong. If your product page relies on an image to show a size chart or an ingredient list with no supporting text, an AI engine can't infer what that JPEG says.
This is one piece of a bigger picture. For a fuller look at what AI crawlers can and can't parse on a page, the guide to AI readability covers crawler access, content structure, and what makes a page extractable.
Where WCAG and AI readability overlap
For informative images, a good WCAG description and a good AI-readable description are usually the same sentence. Take the real estate photo again. "Two-story brick colonial with attached garage and covered front porch" is exactly what a screen reader user needs, and it's also exactly what an answer engine needs to match a question about homes with covered porches. The same holds for product images, where material, color, and use case help both a blind shopper and an AI shopping assistant, and for charts with a text summary nearby.
Specificity is the through-line. Vague alt text fails a WCAG review and gives AI crawlers nothing for the same reason: it doesn't say anything.
Where they diverge
Decorative images look like a split at first. WCAG wants alt="" so assistive tech skips them, and an empty attribute gives an AI crawler no signal either. But there's nothing useful to say about a background texture, so "nothing" is the right answer for both audiences.
Keyword stuffing is where advice really goes wrong. Alt text like "blue running shoes cheap running shoes buy running shoes online" used to be a gray-hat SEO trick, and some advice still recommends it. It fails WCAG because it doesn't accurately describe the image, and it hands AI systems text that reads like ad copy instead of a fact about the picture. Write for the person first, and relevant terms will show up where they genuinely fit.
Context is the other difference. WCAG cares about the text alternative itself. Search engines and AI systems also read the caption, the file name, and the text around the image. So a page can have technically perfect alt text and still give machines little to work with if the image sits in a carousel with no surrounding copy, or if it only appears after JavaScript runs. The section on checking your alt text below covers that second problem.
Does alt text still matter for traditional SEO?
Yes. Search engines used alt text to understand images long before AI answer engines arrived, and Google's own image guidance recommends descriptive alt text over keyword-stuffed variations. The same approach that satisfies WCAG and helps AI engines also improves your odds in classic image search. There isn't a version of good alt text that only works for one audience, which is why it's worth doing properly instead of treating it as a compliance checkbox.
What are common alt text mistakes to avoid?
A few patterns are easy to get wrong in any industry.
- File name as alt text.
alt="DSC_0912_final_v3.jpg"tells the user nothing. This happens when a CMS fills in alt text from the upload file name and nobody goes back to fix it. - Logos that just say "logo." Use the company name instead. If the logo links to the homepage, the company name works, and so does "Return to homepage" if that's literally its function. File names and one-word labels like "image" or "logo" are covered in our fix guide for redundant and unhelpful alt text.
- Alt text that repeats the text beside it. If the link text or caption right next to an image already says "Spring menu," alt text that also says "Spring menu" makes a screen reader announce it twice. Describe what the text doesn't, or use
alt=""if the image adds nothing. - Linked images that describe the picture instead of the destination. When an image is wrapped in an
<a>tag, its alt text becomes the link's name. "Photo of team" is wrong if clicking it goes to the About page; "About our team" is right. And if a linked image has an empty alt with no other text in the link, the link has no name at all. The fix guide for images inside links and buttons shows how to fix both.
What about complex images like charts, graphs, and infographics?
Alt text alone often isn't enough for a data-heavy image. A bar chart showing five years of revenue growth can't be summarized meaningfully in one sentence, and it shouldn't be.
The standard approach has two parts. Write a short alt text that identifies what the chart is, then put the underlying data in real text near the image: an HTML table, a summary paragraph, or a link to a full-text version.
<figure>
<img src="revenue-chart.png" alt="Bar chart of quarterly revenue, 2021 to 2025. Data in the table below.">
<figcaption>Revenue grew every year in this period.</figcaption>
</figure>
<table>
<caption>Quarterly revenue, 2021 to 2025</caption>
...
</table>
That serves screen reader users, who can move through a real data table far more efficiently than they can follow a paragraph-length alt description. It also serves AI crawlers, which can pull data from structured HTML tables with much higher fidelity than from any image, no matter how good its alt text is.
This is a case where accessibility best practice and AI readability point in exactly the same direction: put the real content in real HTML, and let the image be a visual supplement rather than the only place the facts live.
How do you check if your alt text is actually working?
Reading every <img> tag on a large site by hand isn't realistic, and a shallow pass on a handful of pages can miss problems everywhere else. A workflow that pairs an automated scan with a manual review covers both scale and accuracy:
- Run an automated scan first to catch the obvious failures: missing alt attributes, alt text that's just a file name, and linked images with no name.
- Review what a tool can't judge. An automated checker can confirm that an alt attribute exists. It can't confirm the description is accurate, or that an empty alt really belongs on a decorative image. Read each one and ask whether it would make sense read aloud with the image hidden.
- Check complex images, such as charts, infographics, and screenshots of data, for a text equivalent nearby, not just an alt attribute.
- Check how images load. Make sure images and their alt text are in the initial HTML the server sends. Images added only by JavaScript after the page loads can be invisible to crawlers that don't run scripts, and the server-rendered content fix guide explains how to fix that.
For the first step, AccessKnight's scanner flags images with no alt attribute, alt text that's only a file name or a generic word like "image" or "logo," alt text that repeats the text right beside it, and linked images whose empty alt leaves the link with no name. It reports those next to a separate AI-readability score for the same page, so you can work on accessibility and AI visibility in one pass.
A specific next step
Pick your five highest-traffic pages and open each one in your browser's inspector. Check every <img> tag for an alt attribute, then read each value aloud with the image hidden. Rewrite anything generic, missing, or copied from a file name using the function-first approach above, set alt="" on anything purely decorative, and add a text equivalent under any chart or infographic. To find the gaps faster, run a free AccessKnight scan on each page first and start with the images it flags.
Frequently Asked Questions
Should alt text include keywords for SEO?
Only if the keyword accurately describes the image. Write the description first, and include a relevant term only where it fits naturally. Forcing in keywords that don't match the picture fails WCAG's requirement for an equivalent text alternative and can look manipulative to search engines and AI crawlers.
What happens if an image has no alt attribute at all?
Some screen readers fall back to reading the file name aloud, which is confusing and unhelpful. It's also a WCAG 1.1.1 failure whether the image is decorative or informative, so every image element needs an alt attribute, even if it's empty.
Do decorative images need alt text?
They need an empty alt="" attribute, not descriptive text and not a missing attribute. An empty attribute tells screen readers to skip the image silently, while a missing one can make some screen readers announce the file name instead.
Can AI search engines read text inside an image?
Not reliably. Some AI systems can run vision models on images, but most crawlers depend on text signals like alt text, captions, and surrounding copy. If a phone number, price, or date only exists inside an image, put it in real text on the page and use the alt text to describe the image itself.
Does alt text matter on CSS background images?
CSS background images can't take an alt attribute, so screen readers and crawlers get nothing from them. That's fine for pure decoration, but if the image carries meaning, make it a real image element with alt text or put the same information in visible text.
How is alt text different from a caption or a title attribute?
Alt text replaces the image for people who can't see it and for machines that can't interpret it. A caption is visible text next to the image that adds context for every reader. A title attribute shows up as a hover tooltip and isn't reliably read by screen readers, so it shouldn't stand in for alt text.
Fix guides for this topic
Step-by-step fixes with copy-paste code for the checks this article covers.
- Images missing alt textWCAG 1.1.1 · Level AW3C: Understanding 1.1.1
- Image alt text is unhelpful or redundantWCAG 1.1.1 · Level AW3C: Understanding 1.1.1
Check your website's accessibility
Scan against all 33 WCAG 2.1 rules and get code-level fix suggestions — free.
Run a free scan →