Alternative text (alt text) is added to images and charts so that people who cannot see them can still have an understanding of the content.
Alt text is not always needed. Below is a guide for determining if and what kind of alt text is needed. Use caution with AI-generated alt text - this is one thing that's best handled by humans.
When Should I Use Alt Text?
An image does not need alt text if:
- It’s redundant to text immediately surrounding it (e.g. portrait image next to a person's name)
- It has a descriptive caption
- It has no meaningful purpose (e.g. a line or shape)
Images that don’t need alt text can be marked as decorative or coded as alt="".
If you’re not sure whether an image needs alt text, try using the Web Accessibility Initiative’s alt text decision tree.
How Do I Write Alt Text?
Alt text should be concise and describe what the image is, not just what it looks like. This can depend on the purpose of and audience for an image.
There is no one-size-fits-all formula for writing alt text. Let's use a map for an example.
- If the map is a background image, the alt text could be "Map of the Midwest region of the United States." Or it may be marked decorative if it truly conveys no meaning.
- If the map is used as a representation of what a map looks like, the alt text could be "A map depicting roads, lakes and rivers with lines and cities with dots."
- If the map is used in content about geography the alt text could be "A map showing the distance from Chicago to DeKalb is 65 miles and major interstates that can be traveled to reach each destination (I-88, I-355, I-290)."
Design best practices suggest that any image used should have purpose and meaning, so it's likely your image will need it. If you are not sure what to write, just describe the image as if you are explaining it to someone who can't see it.
Top Tips for Alt Text
- Don’t begin with “image of” or similar phrases. Screen readers automatically announce images, so this would be redundant for the user.
- Use standard grammar conventions. Capitalize the first word and end with a period (if a complete sentence).
- Include relevant keywords. Since alt text is indexed by search engines, this can help improve your search ranking.