Fix guide · SVG images without alt text

How to fix “<svg> elements with an img or image role must have alternative text”

By · Updated

An SVG graphic is marked as an image (role="img") but has no text alternative. Give it an aria-label or a title element inside it, or, if it's decoration, remove the role and add aria-hidden="true".

axe rule
svg-img-alt
WCAG
1.1.1 Non-text Content (Level A)
Lighthouse
Google Lighthouse and PageSpeed Insights report it as “SVG elements with an img role do not have an accessible text alternative”

What it means

Logos, icons and charts are often drawn as SVG code right in the page. Adding role="img" tells a screen reader to treat it as one picture, which is good, but then it needs a name the same way an img tag needs alt text.

Who it affects

People who use a screen reader.

How to find it

  1. Run the free checker. It lists the SVG's opening tag, which usually carries a class name that tells you what it is.

How to fix it

  1. If the SVG carries meaning (a logo, a chart, an icon with no text beside it), add aria-label, or a title element as its first child.
  2. If it's decoration, or there's text right next to it saying the same thing, take off role="img" and add aria-hidden="true" so it's skipped.

A logo drawn in SVG

Before · fails
<svg role="img" viewBox="0 0 120 40">...</svg>
After · fixed
<svg role="img" aria-label="Sample Marine" viewBox="0 0 120 40">...</svg>

A decorative icon next to text

Before · fails
<svg role="img" class="icon-phone">...</svg> Call us
After · fixed
<svg aria-hidden="true" class="icon-phone">...</svg> Call us

What a scanner can and can’t tell you

Fixing this clears one automated check. It doesn’t mean the page is accessible, and it doesn’t settle any legal question. Automated tests catch only part of the problems. W3C puts it plainly: evaluation tools “can not determine accessibility, they can only assist in doing so.” The rest takes a person working through the site with a keyboard and a screen reader.

Source: W3C WAI, Selecting Web Accessibility Evaluation Tools. Not legal advice.

Sources

All checked November 8, 2026. The rule wording is axe-core 4.14.0’s own.

Related fixes

Every fix guide →

Check a page for free

Scan any page of your site against WCAG 2.1 AA in about 30 seconds. You get the problems automated testing finds, in plain words, with a link to a fix guide for the common ones.

Run the free checkno sign up · one page at a time

Rather have someone fix it for you? Tell me about your site.