Every image on a web page can carry an alt attribute: a short piece of text that takes the image's place when it cannot be seen. A screen reader speaks it aloud, a browser shows it when the file fails to load, and search engines read it to understand what the picture shows and why it is on the page.
When the attribute is missing entirely, each of those readers has to guess. Some screen readers fall back to announcing the file name, so a visitor hears something like IMG_4821.jpg instead of a product description. A search engine loses one of its clearest hints about the image. The fix is usually small, but it requires a decision for each image: does it carry information, does it do something, or is it there purely for decoration?
This guide explains how the alt attribute works, the difference between a missing alt and an intentionally empty alt="", how to write alt text that fits its context, how to treat logos, images of text and charts, and how to fix and verify alt text on common stacks and in CMS workflows. Examples use example.com.
Scope of this guide
This guide covers the alt attribute on img elements as seen in public HTML. Automated checks can detect a missing attribute but cannot judge whether alt text is accurate or useful; that needs human review. It is not a WCAG conformance assessment.
1. What the alt attribute does, and why missing differs from empty
The alt attribute on an <img> element provides the image's text alternative. WCAG 2.2 Success Criterion 1.1.1 Non-text Content, a Level A requirement, says all non-text content presented to the user needs a text alternative that serves the equivalent purpose, with an exception for pure decoration, which should be implemented so assistive technology can ignore it. The HTML standard explains how the attribute expresses that in markup.
There are three possible states, and they mean very different things:
- Descriptive alt, such as
alt="Red waterproof hiking jacket, front view": the image carries information and this text replaces it. - Empty alt, written
alt=""with nothing between the quotes: the author has decided the image adds nothing a non-sighted reader needs. Screen readers skip it. - No alt attribute at all: the author has said nothing. Assistive technology cannot tell whether the image matters, so some screen readers announce the file name or the image URL, and others announce just "image" or "unlabeled graphic".
The missing state is the one to eliminate. An empty alt is a deliberate, correct choice for decorative images; a missing alt is an unanswered question. Note that alt=" " with a space is not the same as an empty alt, and the title attribute is not a substitute: it is not reliably announced and only appears as a mouse tooltip.
2. Informative, decorative or functional: deciding what each image needs
The W3C alt decision tree starts from one question: what does this image contribute to the page? The answer decides the alt text, not the file type or how pretty the image is.
| Image type | Everyday example | What the alt should contain | Example markup |
|---|---|---|---|
| Informative | Product photo, team portrait, photo in a news story | The information the image conveys in this context | alt="Ceramic mug in sage green with a copper handle" |
| Decorative | Background swirl, divider, stock photo beside a heading that already says everything | Nothing: an empty alt so it is skipped | alt="" |
| Functional | Logo linking to home, magnifier icon in a search button | The action or destination, not the appearance | alt="Example Store home", alt="Search" |
| Image of text | Banner with a sale headline baked into the picture | The same words that appear in the image | alt="Winter sale: free shipping this week" |
| Complex | Chart, diagram, map | A short summary in alt plus the full data in nearby text or a table | alt="Bar chart of monthly signups, detailed in the table below" |
| Redundant | Icon next to a link whose text already says "Download PDF" | Empty alt, so the label is not read twice | alt="" |
One trap deserves attention: an image that is the only content of a link or button is never decorative. If you give it alt="", the link has no accessible name and a screen reader announces only "link". The alt must say where the link goes or what the button does.
Purely decorative images are often better moved out of the HTML into CSS backgrounds, where they never appear in the accessibility tree at all.
3. How to write good alt text
Good alt text is written for the page it sits on. The same photo of a person can need different alt text on a staff directory (their name and role) and on a blog post about remote work (what they are doing). The WAI images tutorial frames it as: what would you say if you had to describe this image over the phone, given why it is here?
Practical rules that hold up in everyday use:
- Be concise and specific. Lead with what matters. "Golden retriever catching a frisbee on a beach" beats "A dog" and beats a paragraph about lighting.
- Skip "image of" and "picture of". Screen readers already announce that it is an image. Mention the medium only when it matters, such as "Watercolor sketch of the harbor".
- Do not repeat surrounding text. If a caption or the next paragraph already describes the image fully, a shorter alt or an empty one avoids hearing the same thing twice.
- Write in the page's language and use normal punctuation; screen readers pause at periods and commas, which helps longer descriptions.
- Include visible text and key facts. A photo of a storefront whose sign shows opening hours should carry those hours if they matter to the page.
- Do not stuff keywords. "Running shoes cheap running shoes best running shoes" is useless to a listener and is described by Google as a negative user experience that may be treated as spam.
Some before-and-after pairs:
<!-- vague -->
<img src="chair.jpg" alt="chair">
<!-- specific -->
<img src="chair.jpg" alt="Oak dining chair with a woven rush seat">
<!-- file name leaking in -->
<img src="hero-final-v3.webp" alt="hero-final-v3">
<!-- decorative hero behind a heading -->
<img src="hero-final-v3.webp" alt="">Many CMSs and upload tools fill alt from the file name by default. Treat those values as missing: they satisfy an automated check while telling a listener nothing.
4. Logos, images of text, charts and inline SVG
Logos
A logo that links to the home page is functional: alt="Example Store home" or simply the company name. Saying "logo" is usually unnecessary. A logo inside a list of partner companies is informative and should carry the partner's name.
Images of text
Text baked into an image cannot be resized cleanly, restyled for high contrast, translated or copied. WCAG 2.2 SC 1.4.5 Images of Text (Level AA) asks you to use real text instead unless the presentation is essential, as with a logo, or can be customised by the user. See Understanding SC 1.4.5. When you do keep a text image, the alt must contain the same words. A promotional banner exported from a design tool is the common case: rebuild the headline as HTML text over a background image where you can.
Charts, diagrams and maps
A single alt cannot hold a dataset. Give a short alt that identifies the image and its main takeaway, and put the detail in the page: a data table, a list or a paragraph next to it. A <figure> with a <figcaption> ties the description visually and semantically to the image.
<figure>
<img src="signups.png" alt="Bar chart: signups rose each quarter of the year">
<figcaption>Quarterly signups; the full figures are in the table below.</figcaption>
</figure>Inline SVG and CSS images
Inline <svg> elements have no alt attribute. For a meaningful SVG, add role="img" and an accessible name with aria-label or a <title> child; for a decorative one, add aria-hidden="true". CSS background images are invisible to assistive technology, so never put meaningful content only in a background image.
5. Alt text and search
Google's image SEO best practices say it uses alt text together with computer vision and the content of the page to understand what an image is about. Alt text is one of the signals that helps an image appear for relevant searches in Google Images, and when an image is used as a link, its alt text helps Google understand the page being linked to, much as anchor text does.
The same guidance warns against keyword stuffing in alt attributes. The best alt text for search is the same as the best alt text for people: an accurate, specific description in context. A few related points from the same documentation:
- Use real
<img>elements for images you want indexed; images that exist only as CSS backgrounds are not indexed by Google. - Descriptive file names, such as
oak-dining-chair.jpg, give a light additional hint. - Place images near relevant text, because the surrounding content also shapes how the image is understood.
Alt text helps machines interpret an image correctly; it does not make an image or page rank on its own. The technical SEO audit guide covers the other on-page signals that work alongside it.
6. Fixing missing alt text on common stacks
Plain HTML and templates
Add the attribute to every <img>. In shared templates such as headers, footers and card components, find where the image is rendered and make alt a required input rather than a hard-coded value:
<img src="/img/team/ana.jpg" alt="Ana Reyes, head of support" width="400" height="400">
<img src="/img/divider.svg" alt="" width="600" height="8">WordPress
The media library and the image block both expose an Alternative Text field. Depending on how the image was inserted, the value used on the page may be the one stored in the post content rather than in the library, so check the rendered page after editing. Theme templates that output featured images or logos should pass through the attachment's alt value instead of leaving it out.
Shopify and other hosted stores
Product and collection media have an alt text field in the admin. Themes decide whether that value reaches the storefront HTML, so if the admin field is filled but the page still lacks alt, the theme template is the place to fix.
React, Next.js and other component frameworks
Pass alt explicitly through image components, and use an empty string, not an omitted prop, for decorative images. The Next.js Image component treats alt as a required prop. Linting rules such as the alt-text rule in eslint-plugin-jsx-a11y catch omissions at build time.
<Image src={product.photo} alt={product.photoAlt} width={800} height={600} />
<Image src="/flourish.svg" alt="" width={120} height={20} />Markdown
The text between the brackets becomes the alt: . Empty brackets, , produce alt="" in common renderers, which is correct only for decoration.
7. Workflows that stop alt text from going missing
Missing alt text is rarely a one-off mistake. It usually comes from a workflow where nobody is asked the question at the moment an image is added. A few habits close that gap:
- Ask at upload, not at publish. Make the alt field visible, and ideally required, in the upload dialog, with a checkbox or toggle that marks an image as decorative and writes
alt=""on purpose. - Separate media alt from placement alt. A library-level description is a good default, but let editors override it per placement, because context changes the right text.
- Brief the people who add images. Writers, merchandisers and agencies need two sentences of guidance: describe what the image shows that matters here; leave it empty only if it adds nothing.
- Review imports and migrations. Bulk imports from spreadsheets, old CMSs or product feeds often drop alt values. Map the alt column explicitly and spot-check a sample after the import.
- Watch third-party widgets. Review carousels, embedded social feeds and marketing pop-ups, which may inject images without alt. Check whether they offer an alt setting before you choose them.
- Add a pre-release check. A lint rule in code and a recurring automated audit on the live site together catch both developer and editor omissions.
Automated tools can confirm that an alt attribute exists; only a person can confirm that it is right. Build a short human review into content QA for important pages such as the home page, product pages and checkout.
8. How to verify the fix
Check both the HTML the server sends and the page as the browser builds it, because images injected by JavaScript only exist in the second.
Static HTML from a terminal
curl -s https://example.com/ | grep -oiE '<img[^>]*>' | grep -vi ' alt='This lists <img> tags without an alt attribute in the server HTML. It is a quick approximation: tags split across several lines are missed by grep, so treat an empty result as a good sign, not proof.
Rendered page in the browser console
// images with no alt attribute at all
[...document.images].filter(i => !i.hasAttribute('alt')).map(i => i.currentSrc || i.src)
// images marked decorative, to review by eye
[...document.images].filter(i => i.getAttribute('alt') === '').map(i => i.currentSrc || i.src)The first list should be empty. Go through the second and confirm each image really is decorative and is not the only content of a link or button.
Accessibility tree and screen readers
- In Chrome DevTools, select an image and open the Accessibility pane to see its computed name and role. Firefox has a similar Accessibility Inspector.
- Listen to the page with a screen reader, such as VoiceOver on macOS or NVDA on Windows. Move through images and links and note any that announce a file name, a URL or just "image".
- Turn images off, or throttle the network until they fail, and read the page: the alt text that appears should make sense in place of each image.
Repeat the checks after theme updates, CMS migrations and new widget installs, which are the usual moments for alt text to disappear.
9. What Sitelemetry checks for image alt text
Two audits report on alt text, each from its own angle:
| Finding | Audit and severity | What it counts | Pages read |
|---|---|---|---|
a11y.img.alt-missing | Accessibility audit, high, mapped to WCAG 2.2 SC 1.1.1 | <img> tags in the HTML that have no alt attribute; alt="" passes as decorative. Evidence shows the count against the total and up to four example image URLs. Reported as not applicable when the page has no images. | The page you submit, read as static HTML |
seo.images.alt-missing | Technical SEO audit, low | Images on each page without a non-empty alt value, shown as a count against the total. Images with alt="" are always included in this count, so review it against your decorative images. | Up to 5 pages on Starter, 15 on Professional, 30 on Enterprise |
Both audits read the HTML the server returns without running JavaScript, so images added later by script are not seen, and inline SVG, CSS backgrounds and the quality of the alt text itself are outside their scope. The accessibility audit lists its own limits, including computed styles, keyboard navigation, focus visibility and dynamic behaviour, and it is not a WCAG conformance assessment. A passing result means every image has an alt attribute, not that each description is accurate.
Both audits run on any public URL without ownership verification and are included in Starter ($49/month), Professional ($149/month) and Enterprise ($249/month). They are not included in the Free plan. A Free account can run them with audit credits: one credit runs one audit in one area at Professional depth, a new Free account starts with one welcome credit per area, and credits work in the web app and through the MCP connection. The free Launch Readiness Snapshot runs 8 passive checks (DNS, email DNS, domain registration, TLS, security headers, HTTPS posture, technology fingerprint and delivery) without signup and does not check alt text. For the wider picture, read the accessibility audit guide, or compare plans on the pricing page.
Common questions
What happens when an image has no alt attribute?
Assistive technology cannot tell whether the image matters. Some screen readers announce the file name or URL, others just say image. Search engines lose a clear hint about the picture. Add descriptive alt text to informative images and alt="" to purely decorative ones.
When should I use an empty alt attribute?
Use alt="" when the image adds nothing a non-sighted reader needs: decorative flourishes, background-style photos, or icons next to text that already says the same thing. Never use it for an image that is the only content of a link or button, because the control then has no name.
How long should alt text be?
As long as needed to convey what the image contributes in context, and usually a short phrase or sentence. Lead with the most important detail. If an image needs more than that, such as a chart, give a brief alt and put the full description or data in nearby text or a table.
Does alt text help SEO?
Google says it uses alt text, along with computer vision and page content, to understand images, and that alt text on linked images helps it understand the destination page. It also warns against keyword stuffing. Accurate, descriptive alt text helps interpretation but does not decide rankings.
Why does one check flag my decorative images and the other does not?
The accessibility check only flags images with no alt attribute, so alt="" passes as an intentional decorative choice. The SEO check counts images without a usable alt value, so images with alt="" are always included in its count. Review that list and leave genuinely decorative images empty.
Sources & further reading
- W3C WAI: Images Tutorialwww.w3.org
- W3C WAI: An alt Decision Treewww.w3.org
- W3C WAI: Understanding SC 1.1.1 Non-text Content (WCAG 2.2)www.w3.org
- W3C WAI: Understanding SC 1.4.5 Images of Text (WCAG 2.2)www.w3.org
- HTML Living Standard: Requirements for providing text to act as an alternative for imageshtml.spec.whatwg.org
- MDN: The Image Embed element (img)developer.mozilla.org
- Google Search Central: Image SEO best practicesdevelopers.google.com
Prepared by the Sitelemetry editorial team. Explore the linked sources for further detail.



