What is alt text (the alt attribute) of an image?
Alt text (the alt attribute) is the text description of an image that goes in the HTML code, inside the img tag, for whoever cannot see it: a person using a screen reader, a browser that does not load the image or a search engine. It describes what the image contributes to the page, not the file, and is left empty when the image is decorative.
Key takeaways
- Alt text stands in for the image when it is not seen: screen readers, browsers that do not load it and search engines read it.
- Google uses it, along with computer vision and the rest of the page, to understand what an image is about; stuffing it with keywords can make Google see your site as spam.
- A decorative image takes an empty attribute, alt="", so screen readers skip it; an image with no attribute at all is something else.
- Alt text written with AI is reviewed before publishing, like the title or the meta description.
In your store admin it shows up as a small field next to each photo, "Add alt text," and in audits as "images missing alt." Plenty of people call it the "alt tag," but it is not a tag: it is an attribute of the img tag, the text that takes the image's place when the image is not seen. It matters to a store because of two readers at once: the shopper using a screen reader and the search engine trying to understand what is in the photo.
How it works
The HTML specification defines it as the text that acts as an alternative to the image, for whoever cannot see it. The practical rule it proposes is a question: if you removed the image, what text would you put in its place? The cases follow from it:[1]WHATWG. HTML Living Standard: requirements for providing text to act as an alternative for images
- An image that carries information: the text says what it contributes, not what the file is.
- A decorative image, which adds nothing: the attribute is empty,
alt="". Empty is not the same as missing: empty tells the machine it can ignore the image. - An image that is the only content of a link or a button: the text describes where it leads or what it does, not the drawing.
- An image with a caption next to it: the alt text does not repeat the caption.
The W3C's accessibility guidelines (WCAG 2.2) make it a level A requirement, the most basic: all non-text content that is presented to the user has a text alternative that serves the equivalent purpose, and what is purely decorative is marked so that assistive technologies can ignore it.[2]W3C, Web Accessibility Initiative. Understanding Success Criterion 1.1.1: Non-text Content (WCAG 2.2)
What Google does with it
Google explains that it uses alt text, along with computer vision algorithms and the contents of the page, to understand what an image is about. If the image is a link, the alt text works as the link's anchor text. What it asks for is useful, information-rich text that uses keywords appropriately and in the context of the page.[3]Google Search Central. Google image SEO best practices Its example, with a photo of a puppy, goes from worst to best: no attribute; a string of words like "puppy dog baby dog pup pups puppies doggies"; "puppy"; and, best, "Dalmatian puppy playing fetch." About the string it warns that it results in a negative user experience and may cause your site to be seen as spam.[3]Google Search Central. Google image SEO best practices
There is a second Google rule that affects stores that generate text in bulk. Its guidance on AI-generated content asks you to review everything generated by hand before publishing it, and extends that review to metadata, including the alt text of images, because it can appear in search results.[4]Google Search Central. Google Search's guidance on using generative AI content on your website A model that describes a photo badly produces an AI hallucination just as if it got the product description wrong.
In a store
A fictional example: the product page of a camera backpack, with four images.
| Image | Weak alt text | Useful alt text | Why |
|---|---|---|---|
| Main photo, the backpack from the front | IMG_4031.jpg |
Gray 20-liter camera backpack, front view with the rain cover stowed | Says what is seen and what sets this product apart |
| Detail of the interior | backpack backpack camera backpack photography |
Interior with padded dividers: one camera body and three lenses | A string of words describes nothing, and Google warns it may make it see the site as spam[3]Google Search Central. Google image SEO best practices |
| Size chart as an image | dimensions |
Exterior dimensions: 12 × 7 × 18 in, weight 3 lb | If the image has text, the alt text provides it; better still, write it on the product page too |
| Decorative icon between sections | icon |
(empty) | It is decoration: it is marked alt="" so the screen reader skips it[1]WHATWG. HTML Living Standard: requirements for providing text to act as an alternative for images |
In the code, the difference between the last two rows is this:
<img src="backpack-dimensions.png" alt="Exterior dimensions: 12 × 7 × 18 in, weight 3 lb" />
<img src="divider.svg" alt="" />
In Shopify, each product image's alt text is written from the file preview, on the product page in the admin. The field takes up to 512 characters, and Shopify recommends staying at 125 or fewer, with brief, descriptive text.[5]Shopify Help Center. Adding alt text to product media
What people often get wrong
That alt text is a slot for keywords. It is a description for someone who cannot see the image, and Google says it without detours: stuffing the attribute with keywords gives a negative user experience and may make it consider the site spam.[3]Google Search Central. Google image SEO best practices The other frequent confusion is thinking every image needs text: a decorative one takes an empty attribute, and describing it only adds noise for whoever is listening to the page.[2]W3C, Web Accessibility Initiative. Understanding Success Criterion 1.1.1: Non-text Content (WCAG 2.2)
How to check it
- Open a product page's source code and search for
<img. Every image should havealt: with text if it informs, empty if it decorates.[1]WHATWG. HTML Living Standard: requirements for providing text to act as an alternative for images - Separate the three cases: no attribute, empty and with text. An image with no attribute is a failure; an empty one is a decision.
- Read the texts aloud without looking at the photos. If you would not know which product it is or what each image shows, the text does not stand in for the image.
- Look for images with text inside, like size or dimension charts: that information has to be in text as well.
- If an AI wrote the texts, review a sample by hand before publishing them.[4]Google Search Central. Google Search's guidance on using generative AI content on your website
Related concept: caption and meta title
Alt text gets confused with other texts around an image. The caption is seen on the page, next to the image, and the HTML specification asks that the alt text not repeat it: each does a different job.[1]WHATWG. HTML Living Standard: requirements for providing text to act as an alternative for images The file name does not count as alt text either: in Google's example, an image with its file and no attribute is the bad case.[3]Google Search Central. Google image SEO best practices And none of them is the meta title, which does not describe an image but the whole page.
To keep going, the catalog and entities reading path orders the rest of the product page terms.
Synonyms
- English
- alt text, alt attribute, alternative text
- Español
- atributo alt, texto alt
Sources
- [1] WHATWG. HTML Living Standard: requirements for providing text to act as an alternative for images. Accessed . ↑ ↑ ↑ ↑
- [2] W3C, Web Accessibility Initiative. Understanding Success Criterion 1.1.1: Non-text Content (WCAG 2.2). Accessed . ↑ ↑
- [3] Google Search Central. Google image SEO best practices. Accessed . ↑ ↑ ↑ ↑ ↑
- [4] Google Search Central. Google Search's guidance on using generative AI content on your website. Accessed . ↑ ↑
- [5] Shopify Help Center. Adding alt text to product media. Accessed . ↑
Change history
- First English version.
- No country-specific law: the term is general.
This definition is published under CC BY 4.0. Reuse this definition freely, crediting Clione with a link to this page.
Related terms
Product page
What a product page is, what data it carries, how Google and AI assistants read it, and how to check that the text and the markup say the same thing.
Product description
What a product description is, what Google Merchant Center and AI assistants ask of it, and how to review it without mixing it up with the meta description.
Ecommerce SEO
What ecommerce SEO is, which pages and data it works on, what Google asks of an online store and how to check that your catalog can be found.
AI-ready product page
What an AI assistant needs from a product page that a person does not: text instead of images, units, identifiers, consistency and access.
Product reviews
What product reviews are, what Google's reviews system evaluates, and the rules for customer reviews.
Meta title
What the meta title (the title tag) is, how Google uses it for the result's title link, what length works and how to write a different one per product page.
Make your catalog easy for bots to read
Clione fills every product page with what bots read best: the JSON-LD graph with its structured data, the meta description and the FAQs. You review and press Push; then we check your live store so it all stays published.