Electrified
How to Write Alt Text for Images in a Blog Post
Alt text replaces a picture for a reader who cannot see it. Four questions from the W3C decide what to write, and when the right text is none at all.
Electrified
A place to write and be read: practical guides on AI safety, security, study skills, history and games, where anyone can write notes and articles.
To learn how to write alt text for a blog post, start from one fact: alt text is the wording that stands in for a picture when the picture is not seen, so it carries what the picture adds to the post and nothing else. A photo or simple graphic gets one short phrase or sentence, a chart gets a short label plus its figures in the body of the post, a picture that works as a link gets the name of where it leads, and a picture that adds nothing gets an empty alt.
On Electrified, a place where anyone can make an account and write short notes and longer articles, a post reaches readers who look at it and readers who listen to it, and the second group meets every picture as words or as silence.
What happens when a picture is not seen
A screen reader turns a page into speech or braille. When it reaches a picture, one of three things happens, and the writer decides which.
- The picture has alt text. The screen reader announces that a picture is there and reads the text.
- The alt is empty, written
alt="". The screen reader passes over the picture and says nothing. - The alt attribute is missing. The software has to fill the gap itself. The W3C's page on decorative images says some screen readers will then announce the file name of the picture.
So a missing alt and an empty alt are opposites. One tells the software nothing, and the listener may hear IMG_2041.jpg read aloud. The other tells it the picture can be skipped. The W3C's tutorial adds a detail: an empty alt must have no space between the quotes, because with a space some screen readers still announce a picture.
Where the alt attribute comes from
The attribute is older than web accessibility guidance. The HTML 2.0 specification, RFC 1866, published in November 1995 under the names T. Berners-Lee and D. Connolly, defines ALT as "text to use in place of the referenced image resource, for example due to processing constraints or user preference." The two reasons it gives are a program that cannot process the picture and a reader who chooses not to have it. In that specification the picture's address was required and the ALT was not.
Accessibility guidance turned the option into a duty. The Web Content Accessibility Guidelines 1.0 were published in final form by the W3C on 5 May 1999, and checkpoint 1.1, marked Priority 1 (one a web developer must satisfy), reads "Provide a text equivalent for every non-text element." The current wording is success criterion 1.1.1 of WCAG 2.2, at Level A: non-text content has "a text alternative that serves the equivalent purpose." The W3C's explanation of that criterion gives the reason text was chosen: text can be rendered through any sense, as speech, as print on a screen or as braille.
The wording has held: "in place of" in 1995 and "equivalent" in 1999. Neither says "describe".
How to write alt text in four questions
The W3C publishes an alt decision tree that asks four questions in a fixed order. The first one answered yes settles the picture.
- Does the picture contain text? If the same words are in the post as real text, the alt is empty. If the words appear only in the picture, the alt holds those words.
- Is the picture used as a link or a button? The alt gives the destination or the action, not the look of the picture.
- Does the picture add meaning to the post? A photo or simple graphic gets a brief description that conveys that meaning. A graph or other complex picture has its information written out elsewhere on the page. A picture that repeats nearby text gets an empty alt.
- Is the picture purely decorative? The alt is empty.
A worked example: one post, four pictures
Take a post on repotting a tomato seedling with four pictures, uploaded from a phone as IMG_2041.jpg to IMG_2044.jpg with no alt at all. A listener may hear four file names and learn nothing. Now run each picture through the four questions.
- A painted strip of leaves across the top. No text, no link, no meaning added, decoration. The alt is
alt="", zero words. - A photo of the seedling lifted out of its pot. The post says to repot once the plant is root-bound but never says what that looks like, so the photo adds meaning. The alt is "Tomato seedling out of its pot, white roots circling the base of the soil", 13 words.
- A line chart of height over six weeks. It holds more than a sentence can carry. The alt is a label, "Line chart of seedling height over six weeks, old pot and new pot", and the post's own paragraph gives the figures: 12 cm in the old pot at week six, 21 cm in the new one.
- A small printer icon that links to a printable version. Question two catches it. The alt is "Print these steps", 3 words.
The listener now hears nothing for the strip, learns what root-bound looks like, gets both numbers from the paragraph that every other reader also sees, and knows where the icon leads. Four file names became three useful phrases and one silence. The chart's figures moved into the body of the post, which is where the W3C's page on complex images asks for them: a short description that identifies the picture, and a long description available to everyone.
Alt text replaces a picture; it does not describe one
The most common mistake is to treat alt text as a caption for someone who cannot see. The W3C's page on informative images says the text alternative "typically isn't a literal description of the image". Its own case is two small icons set before two numbers, a telephone and a fax machine. The alt texts are "Telephone" and "Fax". The icons are there to say which number is which.
It follows that one picture can need different alt text in different posts. The tomato photo carries the roots in a post about repotting. In a post about choosing pot sizes, the same photo would carry the width of the pot.
WCAG also lists what fails. Its failure note F30 gives the check: if the text cannot be used in place of the picture without losing information or function, it is not an alternative. Its examples are placeholder words such as "image" or "picture", labels such as "picture 1", and file names such as "Chart.jpg". The W3C's tips page adds that the words "image of" are usually wasted, since the screen reader has already announced that a picture is there.
The strongest objection to the empty alt
The empty alt rests on a judgment, and the W3C says so: whether a picture is decorative or informative is "a judgment that only the author can make". The writer decides, alone, that a reader who cannot see the picture loses nothing by not hearing about it. The W3C's list of decorative cases includes pictures that illustrate nearby text without adding information, which would cover a mood photo at the top of a post.
The accessibility course on web.dev pushes back on that. Its lesson on images warns that "decorative" means different things to different people and that some screen reader users want every visual described. Its argument is about who holds the choice: a listener can skip a description that is there but cannot imagine one that is not. Its advice is "When in doubt, add descriptions to your images."
The two give opposite instructions for the same header photo. The W3C worries about what it calls audible clutter, the web.dev lesson about a decision made for the listener without asking.
What is not settled about alt text
Length has no agreed number. The W3C's tips ask for "the most concise description possible" and move anything longer than a short phrase or sentence into a long description. The web.dev lesson says there is no limit on how many characters a screen reader can read, then reports the usual advice to stay at 150 characters or fewer to avoid tiring the listener. One source gives a number and the other does not.
The decision tree is also open about its edges: its last line says it does not cover all cases, and there the writer has to choose.
None of the pages cited here measures what listeners prefer. They state principles and give examples. How much description people who use screen readers want for an ordinary blog photo is a question about readers, and it is answered by asking them.
Frequently asked questions
Should alt text start with "image of"?
Usually not. Screen readers announce that a picture is present, so the words repeat what the listener has just heard. The W3C allows naming the kind of picture when that matters, such as a painting against a photograph.
What is the difference between empty alt text and no alt text?
An empty alt, alt="", tells a screen reader to skip the picture. A missing alt tells it nothing, and some screen readers then read out the file name.
How long should alt text be?
A short phrase or one sentence for a photo or simple graphic. A chart or diagram needs a short label in the alt and its full information in the text of the post.
What alt text asks of a writer
Alt text has to say why the picture is in the post, and that forces a question most writers skip: what does this picture add? When the answer is "the roots", the alt text writes itself in a dozen words. When the answer is "nothing", the honest alt is empty, or the picture can go. When the answer is "six weeks of measurements", the numbers belong in the post where every reader can find them. The attribute was defined in 1995 as text to use in place of a picture, and writing it well still comes down to knowing what the picture was for.
Electrified


