# Alternative text

## What it is

Alternative text gives an image a textual equivalent for the context in which it is used. A reader can encounter that text through a screen reader or when an image cannot be loaded. The useful alternative explains what the image contributes to the page. It can describe an important observation, name the destination of a linked image or provide a short equivalent for text that appears only inside the image.

The purpose determines what to write. A photograph of a machine might show the location of its emergency stop in a maintenance guide. The same photograph might illustrate workplace conditions in a case study. Each use can need different details. For a decorative image that adds no information, an explicit `alt=""` lets assistive technology skip the image. A missing alt attribute can produce a different result.

Complex images can need more than a short description. A chart can have a concise alternative identifying its subject and an adjacent explanation or table carrying the figures. This arrangement lets a reader understand the result and inspect the details without receiving the entire chart as one unbroken label. Keep the relationship between those pieces clear and test their reading order.

## Why it matters

An image can carry evidence the surrounding prose leaves implicit. A before-and-after screenshot might show where layout changed or how a status became visible. A reader who cannot see the screenshot still needs the part that supports the conclusion. A carefully written alternative or nearby description can make that evidence available without listing every insignificant object on the screen.

Image-based controls have a different consequence. A linked icon can carry the accessible name of the link if it supplies its only text equivalent. The useful wording describes the action or destination. If there is already an adjacent visible label within the same control that supplies the name, an empty alternative for a redundant icon can avoid an extra announcement. Check the complete control, since the text a user hears follows the markup and the accessible name computation.

Translation also matters. A meaningful description in one language is useful only to its intended readers, and awkward text order can obscure the point when a description is announced in another language. Place the wording where localisers can see its context. Review an image and the text around it together in each edition that uses a different description.

## What it looks like in practice

Consider a project page with a photograph, a decorative separator and a results chart. Describe what the photo shows where it supports the work, such as the arrangement of equipment that the article discusses. Mark the separator as decorative if it adds no information. Give the chart a short identification and put the actual comparison or data table near it. Then read the page in document order, including labels and captions.

Think separately about the caption. A photo caption can identify the location or credit its maker. The alternative can state what the image shows that matters to this article. If the caption already delivers the essential point to every reader, decide whether a second description adds anything. Test the composed result with similar adjacent elements, because repeated or overly long announcements can make it harder to find the next passage.

Engineer's site credits describe the role of human judgement in checking whether an image's alternative says the useful thing. This is practical guidance for the project-page example. Tools can inspect whether attributes and structure are present. A person can compare the text with the image's actual role and decide whether it makes the intended evidence available.

Review the page after smaller viewports select a different crop. If the important feature has moved out of view, the visual composition and the description may disagree. Test the text and image together at the size users actually see.

A content editor can check a chart description by answering the question without opening the image. If the picture shows that response times fell after a release, can the reader learn when, by how much and over which period from the surrounding material? Include units in any alternative table. For a thumbnail that opens an enlarged chart, the link also needs a name that explains what opening it does. Verify this with a screen reader on the actual page. The accessible name of a control and the explanation of a chart are separate pieces of content, even when one element supplies both.

## Where it goes wrong

An alternative can name the type of image while leaving out its purpose. A chart described only as Graph tells a reader little about the comparison. Begin with the question the image answers and supply the answer or a convenient path to the details. Check the description at the point where an ordinary reader would encounter it.

Another mistake is using the same label on a group of images that perform different jobs. A repeated label can make the images hard to distinguish, particularly in a gallery or list of actions. Give them alternatives grounded in their individual purpose. Use an empty alternative where the image contributes only decoration to content already explained beside it.

Finally, keep the wording attached to the current design and data. Update it when an image, crop, caption or label changes. A useful check can show whether text is present and how it participates in the document's semantics. The editorial review should explain what a reader learns from the alternative and whether that is the useful result the image was meant to provide.

## Further reading
* WAI's alternative-text decision tree. Helps authors choose alternatives based on an image's purpose.
* WCAG Non-text Content. Explains equivalent purpose and common situations.
* The HTML Standard on alt text. Describes applicable requirements and examples.

=> /credits/ site credits
=> https://www.w3.org/WAI/tutorials/images/decision-tree/ WAI's alternative-text decision tree
=> https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html WCAG Non-text Content
=> https://html.spec.whatwg.org/multipage/images.html#alt The HTML Standard on alt text

=> https://engineer.company/glossary/alternative-text/ This page on the web
