Accessible Icons and Icon Buttons
Icons are everywhere on modern sites: menu symbols, search magnifiers, social logos, arrows. They are quick for sighted users, but they do not explain themselves to assistive technology or to everyone who sees them. A little care makes them work for all.
Two kinds of icons
Decorative icons
An icon next to a visible text label adds nothing for a screen reader user, because the text already says it. Hide the icon so it is not announced twice. For inline SVG, use aria-hidden="true" and make it non-focusable. For images, use empty alt text.
Meaningful icons
When an icon carries information or is the only content of a control, it needs a text alternative. A magnifying glass button needs a name like "Search"; a shopping bag needs "Cart".
Naming icon-only buttons
Options, in order of preference:
- Visible text. The most accessible option is often to show a label beside the icon. It helps everyone, including people who do not recognize the symbol.
- Visually hidden text. Add text inside the button that is hidden visually but available to screen readers.
- aria-label. Provide the name as an attribute. Keep it short and clear.
Check that the name describes the action, not the picture. "Open menu" is better than "hamburger". See ARIA basics: when to use ARIA.
Icon fonts and SVG
Icon fonts can be read aloud as odd symbols or fail to load, leaving empty boxes. Inline SVG gives more control and usually works better. Whatever you use, test with a screen reader. See icons in web design.
Make icons clear to everyone
- Use familiar symbols, and avoid unusual ones for important actions
- Do not rely on the icon alone. Many people, including those with cognitive disabilities, understand text better
- Keep consistency. The same icon should always mean the same thing
- Check contrast. Meaningful icons need at least a 3:1 contrast ratio against the background under WCAG's non-text contrast rule. See color contrast for accessible websites
- Do not use color alone to show a state, such as red for an error. Add a shape or text. See color blindness and web design
Size and spacing
Give icon buttons a comfortable target size, and enough space between neighbors. WCAG 2.2 sets a minimum of 24 by 24 CSS pixels, with exceptions, and larger is better on touch screens. See touch target sizes for mobile.
Social media icons
A row of logos linking to profiles needs names such as "Instagram" so that a screen reader says something more useful than "link". If they open another site, say so where practical.
Voice control
People who use voice control often say the visible label of a control to activate it. If an icon button has a hidden name that is different from any visible text, they may not know what to say. Keep names consistent with visible text where you can. See voice control and speech recognition users.
Test it
Go through the page with a screen reader and read out the buttons. Can you tell what each one does? See how to test with a screen reader.
Common mistakes
- Icon buttons with no name
- Announcing decorative icons
- Names like "icon" or "button"
- Tiny, low-contrast icons
Another area where icons and images stand in for people is human verification. Read accessible CAPTCHA alternatives.