# Accessible SVG: Text Alternatives for Icons, Logos

Source: https://allyway.ai/glossary/accessible-svg

Accessible SVG means scalable vector graphics that assistive technology can handle correctly: an SVG that carries meaning gets role="img" and a text alternative, a decorative SVG is hidden with aria-hidden="true", and an icon inside a link or button leaves the name to its control. SVGs are non-text content under WCAG 1.1.1 at Level A.

Accessible SVG is about giving vector graphics the same treatment as images: a text alternative when they mean something, silence when they don't. Logos, icons, illustrations and simple charts are often inline SVG, and without extra markup screen readers either skip them, read out "image" with no name, or announce a jumble of path data. A few attributes make the difference.

## What it means

Every SVG is non-text content under [WCAG 1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html) (Level A): "All non-text content that is presented to the user has a text alternative that serves the equivalent purpose." The exceptions matter for SVG too – controls need a name that describes their purpose, and decoration must be implemented so assistive technology can ignore it. W3C's test rules check that an SVG element with an explicit role has a non-empty accessible name.

In practice there are four cases:

| SVG is … | What to do | W3C technique |
|---|---|---|
| A meaningful graphic or logo | `role="img"` plus `aria-label` or `aria-labelledby` pointing to its `<title>` | ARIA6, ARIA10 |
| Decorative (flourish, background shape) | `aria-hidden="true"` and no `role` | Decoration exception |
| An icon inside a link or button | Hide the SVG, give the control a name | Controls exception, see 4.1.2 |
| A chart or diagram | Short name plus a longer description or data table | G95, ARIA15, G74 |

An `<img src="logo.svg">` works like any other image and takes an `alt` attribute – see [alt text](https://allyway.ai/glossary/alt-text). The tricky part is inline `<svg>`, because browsers don't treat it as an image by default.

> **Note:** > **`<title>` alone is not enough**
> A `<title>` inside an SVG is often shown as a tooltip but read inconsistently by screen readers. Pair it with `role="img"` and `aria-labelledby` pointing to the title's `id`.

## Examples

```html title="Example"
<!-- Meaningful graphic -->
<svg role="img" aria-labelledby="award-title" viewBox="0 0 64 64">
  <title id="award-title">Winner of the 2026 Design Award</title>
  <path d="…" />
</svg>

<!-- Decorative wave -->
<svg aria-hidden="true" focusable="false" viewBox="0 0 400 40">
  <path d="…" />
</svg>

<!-- Icon in a button: the button carries the name -->
<button type="button" aria-label="Search">
  <svg aria-hidden="true" focusable="false" viewBox="0 0 24 24"><path d="…" /></svg>
</button>
```

The award badge is announced as an image with its name. The wave is invisible to screen readers, just like other [decorative images](https://allyway.ai/glossary/decorative-images). In the search button, the SVG stays silent and the `aria-label` becomes the button's [accessible name](https://allyway.ai/glossary/accessible-name) – without it, you would have an [icon button](https://allyway.ai/glossary/icon-button) that says nothing. `focusable="false"` keeps older browsers from putting the SVG in the tab order.

**Do:** Do

Decide for each SVG whether it carries meaning, add `role="img"` and a short name to meaningful ones, hide decorative ones with `aria-hidden="true"`, name the control rather than the icon, and make sure icon colors also meet [non-text contrast](https://allyway.ai/glossary/non-text-contrast).

**Don't:** Don't

Rely on a `<title>` alone, put `aria-label` on an SVG that has no role, give an icon and its button two different names, leave decorative SVGs exposed, or use an SVG of text instead of real text.

## How to check accessible SVG



## Questions

Q: How do I add alt text to an SVG?
A: For `<img src="file.svg">`, use the `alt` attribute as with any image. For inline `<svg>`, add `role="img"` and either `aria-label="…"` or `aria-labelledby` pointing to a `<title>` inside the SVG.

Q: Should SVG icons have aria-hidden?
A: Yes, when the icon sits next to visible text or inside a link or button that already has a name. Then the icon is hidden with `aria-hidden="true"` and the control carries the name. A standalone icon that conveys information needs its own name instead.

Q: Does an SVG logo need alt text?
A: Yes, a logo carries meaning – usually the company name. If the logo is also the link to the home page, name the link, for example "Acme Bakery – home", and hide the SVG inside it.

Q: How do I make an SVG chart accessible?
A: Give it a short name with `role="img"` and provide the full information in text – a description next to it or a data table. W3C calls this a short plus a long text alternative.

Q: What does focusable="false" do on an SVG?
A: It stops some older browsers from putting the SVG into the tab order. Modern browsers don't need it, but it does no harm on decorative SVGs and icons.
