How to write good alt text: rules and before/after examples

One short, factual sentence in the page's language: the rules of good alt text, before/after examples and the cases where it is better to leave it empty.

An image’s alt text is a single sentence, yet it is the sentence most often rushed. Here are the rules that make the difference, with before/after examples you can apply today.

What is alt text for?

  • It is read by screen readers, which let blind and visually impaired people understand the image.
  • It is displayed in place of the image when the image fails to load.
  • It helps search engines understand what the image shows.

The rules of good alt text

  • Describe what is visible, in one sentence, as if you were describing it over the phone.
  • Stay short: around 125 characters, the usual recommendation for screen readers.
  • Do not invent places, brands or promises that are not in the image.
  • Skip “image of” or “photo of”: the screen reader already announces it is an image.
  • Write in the language of the page where the image appears.
  • Think about the image’s function: for an image that works as a link, describe the destination or the action, not the drawing.

Before / after

  • File name — before: “IMG_2024.jpg”; after: “White ceramic mug on a light wooden table.”
  • Too poor — before: “mug”; after: “White ceramic mug with a rounded handle.”
  • Keyword stuffing — before: “cheap mug ceramic buy white mug sale”; after: “White ceramic mug with a rounded handle.”
  • Image link — before: “logo”; after: “Back to the Toitures Martin home page”
  • Project photo — before: “job site”; after: “Roofer laying slates on a pitched roof.”

When to leave the alt text empty

A purely decorative image (a rule, a pattern, an illustration that repeats the neighbouring text) should have an empty alt attribute, not a missing one: an empty alt tells the screen reader to move on, whereas a missing alt may make it read out the file name.

Special cases

  • Charts and infographics: a short alt that states the subject, and the detailed data in the text next to it.
  • Images that contain text: repeat that text in the alt.
  • Product photos: colour, material, view, visible use. Keep sales arguments for the product page.

And when you have thousands of images?

Writing by hand is fine for a few dozen images. Beyond that, an extension like SafeAlt writes the alt text, title and caption of each image with AI. Always review your important images: an AI can be wrong about what it sees.

25 images a month are free, without a credit card.