Alt text (alternative text for images)
What alt text is, an HTML example, who reads it, when it stays empty, and how it differs from the title attribute, a caption and the file name.
On this page
Alt text is the text in an image's alt attribute that stands in for the image when it cannot be seen: screen readers read it aloud, search engines use it to understand the image, and browsers show it when the image does not load.
What alt text is in practice#
Alt text is a short description that lives in the HTML of a page, in the alt attribute of an image. Shoppers who see the image never notice it. It matters for everyone and everything that does not see the image: a person using a screen reader, a search engine's crawler, a browser that could not load the file.
<img src="/images/northpeak-beam-400-headlamp-black-front.jpg"
alt="Northpeak Beam 400 rechargeable headlamp in black, front view"
width="1500" height="1500">The HTML standard states the goal in one sentence: replacing every image with the text of its alt attribute should not change the meaning of the page. In a shop system you rarely type the attribute yourself. You fill an "alt text" field on the image, and the theme writes the attribute.
Who reads alt text#
| Reader | What it does with alt text | Source |
|---|---|---|
| Screen readers | Read the text aloud in place of the image. WCAG success criterion 1.1.1 (Level A) asks for a text alternative that serves the equivalent purpose | W3C, Understanding 1.1.1 |
| Search engines | Google uses alt text to understand what an image shows, and as anchor text when the image is a link | Google Search Central |
| Browsers | Show the text in place of an image that is not available | HTML standard |
When the attribute stays empty#
A purely decorative image gets an empty attribute: alt="". W3C's page on decorative images says this lets assistive technologies ignore the image. Leaving the attribute out is not the same: W3C notes that some screen readers then announce the file name.
Alt text, title, caption and file name#
| Thing | Where it is | Who sees it | What it is for |
|---|---|---|---|
| Alt text | alt attribute of img | Not visible while the image shows | Stands in for the image |
| Title | title attribute | Often a tooltip on mouse hover | Supplemental information, in the HTML standard's words. The description of the image belongs in alt |
| Caption | Visible text next to the image, for example figcaption | Everyone | Adds context that all readers should get |
| File name | The last part of the image URL | Visible in the URL only | Google recommends short, descriptive file names such as northpeak-beam-400-headlamp-black-front.jpg over IMG00023.JPG |
The four do not replace each other. An image with a caption still needs an alt attribute, and a descriptive file name does not describe the image to a screen reader user.
What it means for a shop#
A product page has many images, and each needs its own alt text: the product, the variant shown and what this image adds, such as the view or a detail. The guide to alt text for product images has a formula, 12 before and after examples and what EU law says about online shops. The free image alt text generator writes alt text for an uploaded or linked image in 12 languages.
Questions
Is it alt text, alt tag or alt attribute?
In HTML it is an attribute: alt on the img element. "Alt tag" is a common but inexact name for the same thing, and "alt text" is the text you put into the attribute.
What is the difference between alt text and a caption?
Alt text replaces the image for people and programs that cannot see it and is normally not visible. A caption is visible text next to the image that everyone reads. The HTML standard says alt text should never contain what could be the image's caption, title or legend.
Does every image need alt text?
Every img element needs an alt attribute, but not every one needs text in it. An image that carries content gets a description. A purely decorative image gets an empty attribute (alt=""), so that assistive technology skips it.
Sources
- HTML Standard: Requirements for providing text to act as an alternative for images (4.8.4.4)WHATWGchecked 23 November 2026
- Images Tutorial: Decorative ImagesW3C Web Accessibility Initiativechecked 23 November 2026
- Understanding Success Criterion 1.1.1: Non-text Content (WCAG 2.2)W3Cchecked 23 November 2026
- Image SEO best practicesGoogle Search Centralchecked 23 November 2026