Write image alt text to replace the information or function that the image provides in its current context. Describe a relevant product detail, name the destination of an image-only link, use alt="" for a purely decorative image, and pair a short alternative with accessible detail for a complex chart.
Start by asking why the image is on the page. There is no universal 80–125-character requirement, and adding a keyword cannot promise a particular ranking or click-through increase.
Alt text, captions and filenames have different jobs
The alt attribute supplies an HTML image's text alternative; “alt tag” is a common informal name. Screen readers can use it to convey image information, and browsers may display it when an image cannot load. A caption is visible explanatory content, while a filename identifies the resource. One does not automatically replace the others.
Google's image SEO guidance says it combines alt text, page content and computer vision to understand an image. It does not publish a 25% ranking weight for alt text, an 81% exclusion rate for generic filenames, or a rule that missing alt eliminates every opportunity for image traffic.
Entering an “image title” in a CMS may not populate the final image's alt attribute. Inspect the published HTML. For linked images, Google also uses alt text to help understand the link, making an accurate purpose particularly important.
Choose the alternative by purpose
| Purpose | Approach | Question to ask |
|---|---|---|
| Informative product detail or screenshot | A concise description of the relevant information | Can someone understand the important distinction without seeing it? |
| Decoration or information fully supplied nearby | An empty alt attribute, not an omitted one | Does skipping it preserve all information and functionality? |
| The only content of a link or button | Name the destination or action | Can a user predict what activating it will do? |
| Essential text embedded in an image | Supply equivalent text, preferably as real page text | Are dates, conditions or instructions available elsewhere? |
| Complex chart, process or diagram | Short alt plus visible detail, a table or a clear long-description link | Are important relationships, units and data available in text? |
The W3C alt decision tree helps make this choice. An image can serve different purposes on different pages. Repeated images with the same purpose do not require arbitrarily different descriptions just to make every attribute unique.
Product images: describe supported details
All filenames, paths and the brand below are teaching placeholders, not assets supplied for download. Replace them with your real resources when implementing the examples.
<img src="backpack-detail.webp"
alt="Black backpack interior with a separate zip pocket"
width="800" height="600">
This alternative fits an interior-detail image, not a front view that hides the pocket. Names and colors should agree with the actual product. Do not infer capacity, material composition, waterproof ratings or load limits from appearance alone.
“Backpack, school bag, travel bag, cheap backpack” is a keyword list, not an equivalent description. Different views can identify distinct details, such as a strap adjuster and an inner compartment, when the images actually show them. Avoid inventing personal identities, health conditions or performance claims.
Decorative images: empty is different from missing
<img src="section-divider.webp" alt=""
width="800" height="16">
This example is for a non-informative divider. Omitting the attribute may cause assistive technology to announce an unhelpful filename. Conversely, a small warning symbol or instructional arrow is not automatically decorative merely because it is visually minor.
W3C's decorative-image guidance also covers information adequately supplied by adjacent text. A vague caption such as “product detail” does not necessarily provide that equivalent. A CSS background cannot take an img alt attribute; essential content or functionality needs another accessible representation.
Linked images: provide an actionable name
If visible text within the same link already names its purpose, an empty alternative can prevent the icon from repeating it:
<a href="/shipping-help/">
<img src="truck-icon.webp" alt=""
width="24" height="24">
Shipping information
</a>
If a logo is the link's only content, identify its destination. “Example Brand” is fictional:
<a href="/">
<img src="example-logo.webp"
alt="Example Brand home"
width="160" height="48">
</a>
For buttons, describe the action, such as “Search” or “Print this page,” rather than only “magnifying glass” or “printer image.” Follow W3C's functional-image examples and inspect the accessible name of the whole control. Do not assign conflicting names to the image and its parent.
Charts and screenshots need usable detail
A straightforward screenshot can describe the relevant control or state without transcribing the entire window. However, text required to follow an instruction must remain available. Complex charts need their important conclusions, units, values and relationships, not just a label such as “sales chart.”
This example uses fictional order counts to demonstrate a short alternative and visible data. It is not a client result or an SEO experiment:
<figure>
<img src="sample-orders.webp"
alt="Example orders: February has 5 more than January; data below."
width="800" height="400">
<figcaption>Teaching data; unit: orders.</figcaption>
</figure>
<table>
<caption>Example order counts</caption>
<tr><th scope="col">Month</th>
<th scope="col">Orders</th></tr>
<tr><th scope="row">January</th><td>10</td></tr>
<tr><th scope="row">February</th><td>15</td></tr>
</table>
The W3C complex-image tutorial gives several short-and-long-description patterns. “Keep alt short” is not permission to discard information. There is no general rule that reproducing 95% of image text achieves compliance. A flowchart's branch conditions may matter more than its number of steps.
Common editorial questions
- Must it be under 125 characters? Be concise, but do not turn a writing convention into a universal HTML, WCAG or screen-reader truncation limit. Move complex information into an accessible longer explanation.
- Must “image” or “photo” always be removed? Usually there is no need to start with “image of.” However, the distinction between a photograph, illustration and diagram can matter. Google's technical-writing guidance emphasizes context and purpose.
- Can a caption repeat the alt text? Avoid needless repetition, but examine the actual information rather than apply a blanket ban. Sources, permission details and AI-generation disclosures belong in suitable visible content or metadata too, not only inside alt.
- Can AI write it automatically? Review the actual image and its context. Models can misidentify parts, people, text or interface states. Grammatical output is not proof of accuracy.
Check the published result
- Compare each image, its surrounding passage and its actual attribute. Distinguish missing alt, justified empty alt and incorrectly empty alt.
- Inspect image and control names in the browser accessibility tree, then test key tasks with keyboard and screen-reader use. Automated findings are prompts for review, not semantic approval.
- Check responsive variants. If a mobile crop removes the detail described in alt, revise the image or alternative-text approach.
- Confirm that resources load and can be crawled, and review image compression, formats and loading. Alt does not repair a broken image or prevent layout shifts by itself.
- With authorized Search Console access, use the Image search type in the Performance report to review impressions and clicks under consistent page and date conditions. Do not attribute every concurrent change to alt.
For a product gallery, continue with ecommerce product-photo, detail and Shopify alt checks. Describe what the image actually contributes, then check page context, delivery and the real user task instead of filling every attribute with the same title.