Alternative Text

Overview

Alternative text (or alt text), is text that describes an image for those who cannot see the image. This text is not visible on screen, but will be read by a screen reader

Alt text that is written well is context dependent and conveys the meaningful visual information in the image. 

Best Practices

Here are some general guidelines for writing good alt text:

  • Keep it short (one or two sentences)
  • There is no need to say “image of," because screen readers say “Image:" before reading alt text. It is OK to include the format if it is meaningful in context: a student's painting, a screenshot, a caricature.
  • Decorative graphical elements such as lines, separators and icons connected to text with the same meaning ("⏸️ Pause") should have empty alt text. Some editors have a checkbox to do this called “Mark as Decorative.”
  • All images must either include alt text or be marked as decorative.

Example

For example, let's say you want to include an image of Nassau Hall in an article on your website but you need to write the appropriate alt text to describe the image. Start by asking the following questions:

  1. What is the context of the article?
  2. What is the meaningful visual information in the image based on the context of the article? This information will help determine what part of the building to focus on in the alt text description.

With those questions in mind, here are some possible alt text descriptions for this image:

Front of Nassau Hall, a stone building with ivy crawling up the walls and two tiger statues on either side of the front door.
Article ContextAlt Text ExampleExplanation
The architecture of Nassau Hall.The front of a stone building with a central cupola over a grid of evenly spaced, paned windows. Ivy climbs the walls behind two statues of tigers, laying down on either side of the front door.”Since the article is about architecture, it should focus on the visual architecture of the building.
The History of Nassau Hall."The front of Nassau Hall today, with ivy crawling up the stone." Since the image doesn't give us any information on the history of Nassau Hall, all that's needed is a description of the building or simply, “Nassau Hall.”
Types of ivy native to Princeton, NJ."Ivy climbing up four stories on the side of a stone building."Since this context has nothing to do with the actual building, the ivy is the focus of the alt text.
An admissions brochure.“The front of a historic stone building with ivy crawling up the sides. Two copper statues of tigers lie on either side of the front door.” Since this is a brochure enticing students to come to Princeton, you may want to focus on campus beauty since just saying “Nassau Hall,” doesn't tell an incoming student much about the campus.
A banner image that has nothing to do with the context."Nassau Hall."There is no meaning in context in this example, so a simple alt works here.

Note that these are just examples of possible alt text for each situation. There will be variations on details and language based on who writes the alt text and what they know about the subject. There is no “right” answer; the alt simply needs to be short, clear, and focused on the relevant, meaningful content of the image.

Decorative Images and Onscreen Elements

Some images are used to break up text and do not contain any meaningful information (e.g. divider lines). These graphics can be marked as “decorative.” This tells a screen reader to skip over the graphic as it does not contain any meaningful information. Here are some examples.

Decorative lines can be marked “decorative.”

decorative line

Icons without meaning can be marked as decorative. In the example below, the labels next to the icons already provide the meaning of the icon. If we put alt text on the icons, it would be redundant.

Example of icons with corresponding labels

Icons with meaning should include alt text. For example, a search icon without a corresponding “search” label would need alt text.

search bar with search icon and no label

FAQ

Here are some frequently asked questions:

Testing for Accessibility

It is helpful to review alt text in context on a page, to see if the alt works together with the text and captions to tell a complete story, without repetition and redundancy. It may help to read out loud, pretending the page is an audio book.

Several tools will draw the alts on the images in context.

Princeton staff maintain two, so tell us if you find bugs:

  • InstaAlt does this and only this.
  • The Editoria11y plugin built in to the University's Drupal and WordPress sites has a button on its toolbar to display alts on images.

Our automated testing tools will also highlight many common mistakes.

For more details consult: