The short answer
Write alt text around the image's purpose in the surrounding content. An informative diagram needs its meaningful information conveyed; a purely decorative image may use an empty alt attribute. Review context before assuming that every empty attribute is an error or that every nonempty one is helpful.
A worked example
A fictional tutorial shows a crop rectangle with a 20-pixel left offset. An alt description can state the rectangle's relevant position rather than listing the screen's colors. A leaf illustration beside the title adds mood but no instructional information; empty alt prevents it from becoming unnecessary reading noise. A linked image needs a separate check of the link's accessible name.
A practical checklist
- Classify the image as informative, functional or decorative in this exact context. The same asset may need different treatment on another page.
- Describe the information or action the reader would otherwise miss. Put long diagram explanations in nearby visible text rather than forcing everything into one attribute.
- Inspect the page with images unavailable and review links or buttons containing images. Use an HTML alt checker to find missing attributes, then make the editorial judgment yourself.
What to avoid
Avoid filling alt attributes with SEO keywords or accepting a generic filename as a description. Automated checks can identify missing or empty attributes, but cannot certify that the chosen words accurately convey the image's purpose.
A useful follow-up
Is empty alt always wrong?
No. It can be appropriate for a decorative image; informative and functional images need contextual review.


