Skip to content
◀ Blog

How to write alt text for charts and graphs

Write chart alt text that tells readers what changed. Use a real line chart to decide which numbers belong in the description and when to add a data table.

Riley Hilliard3 min read

openchartaccessibility

“Line graph of commits over time” names the picture and leaves the reader to guess what happened. For chart alt text, start with the comparison someone came to the chart to make. Name the measure and the period, then give enough detail to support that comparison. If readers need to look up individual values, put a table beside the chart. W3C’s guidance on complex images

Write the sentence from the data

Take the first four weeks of OpenChart’s line in the Steamfield commit-history chart. The counts come from Git history and exclude merge commits. A week ends on Sunday. Here’s the same slice in the two views available on the chart.

Week ending in 2026 Commits that week Commits since May 4
May 10 41 41
May 17 13 54
May 24 3 57
May 31 0 57

For a line graph of weekly commits, I’d use this description for the four-week slice.

Weekly OpenChart commits fell from 41 in the week ending May 10, 2026, to zero in the week ending May 31.

For the cumulative view of those same weeks, I’d write a different sentence.

OpenChart recorded 41 commits in the first week. Its running total reached 57 by May 24 and stayed there through May 31.

A falling line and a rising line can both be accurate here. When a chart has a switch for weekly or cumulative values, the selected measure belongs in its text equivalent too. A week with zero commits tells us nothing about work people hadn’t committed yet.

Decide what belongs in the caption

For a complex chart, the short description can identify the graphic and point to a longer description nearby. A visible caption gives everyone context, such as the source of these counts and the date the four-week window starts. When the caption already states the finding, a shorter image description can identify the series and direct readers to the values below.

For an SVG served through an img element, put the short description in alt and the table immediately after the figure.

<figure>
  <img
    src="openchart-weekly.svg"
    alt="Weekly OpenChart commits, May 4–31, 2026. Values in the table below."
  />
  <figcaption>
    OpenChart commits fell each week in this four-week sample. Source: OpenChart
    repository history.
  </figcaption>
</figure>

An inline SVG needs its own accessible name. On this site OpenChart writes SVG during the build, and a spec’s a11y.description field lets the author supply text for the graphic. When you edit a spec that has several views, inspect the rendered graphic in your browser’s accessibility tree and switch views with that tree open. In the Steamfield example, switching from Each week to To date changes the accessible label from “commits each week” to “commits to date.”

When does a chart need a data table?

Try answering a reader’s question with the image covered. “Did commits slow down in May?” is answerable from the weekly description. “How many commits landed in the week ending May 17?” requires a lookup. A table lets a reader find the row for that week and hear its column heading without listening to every value on the line.

For a chart comparing several series, name the series in the description. “OpenChart” still means something when read aloud. “The pink line” requires the reader to see both the plot and its legend. If the result depends on an outlier between two endpoints, spend the next sentence on that outlier, even if it means leaving the endpoints to the table.