ARIA guide

aria-label, aria-labelledby and aria-describedby: when to use each

All three attributes change what a screen reader announces, but they do different jobs. Two of them set an element’s accessible name (what it is called) and one sets its description (extra detail). Pick the wrong one and you either hide visible text from assistive technology or announce a label nobody can see.

Reviewed by Khushwant Parihar, CPACC

Updated

The short answer

Which attribute to use
AttributeSetsTakesUse it when
aria-labelledbyNameOne or more IDsThe label is already visible on the page, such as a heading over a dialog or a section.
aria-labelNameA text stringThere is no visible text to point to, such as an icon-only button.
aria-describedbyDescriptionOne or more IDsThe control already has a name and needs supporting detail: a hint, a format, an error.

Before any of them, try native HTML. A <label for> on a form field, alt on an image, or real text inside a button names the element without ARIA and works everywhere. The first rule of ARIA is not to use it when HTML already does the job.

How browsers pick the name

Browsers compute one accessible name per element, following the W3C Accessible Name and Description Computation. Simplified, they take the first of these that produces text:

  1. aria-labelledby, joining the text of every referenced element in order.
  2. aria-label.
  3. The native label: <label>, alt, <caption>, <legend> and so on.
  4. The element’s own content, for roles that take their name from content (buttons, links, headings, tabs, options).
  5. title, and for inputs placeholder, as a last resort.

Two consequences catch people out. An aria-label on a link silently replaces the link text, and an aria-labelledby beats an aria-label on the same element. Check what you actually get with our accessible name previewer.

aria-label

The classic case is a control that shows an icon and no words:

<button type="button" aria-label="Close dialog">
  <svg aria-hidden="true" focusable="false">...</svg>
</button>

Hide the icon itself with aria-hidden="true" so it is not announced as a stray image. Other good uses: telling apart several <nav> landmarks (aria-label="Primary", aria-label="Footer") and naming a search field whose only visible label is a magnifying glass.

Keep it short, write it as a name rather than an instruction (“Close dialog”, not “Click to close the dialog”), and do not repeat the role: screen readers already say “button”. Because the text lives in an attribute, some machine translation tools leave it untranslated, which is one more reason to prefer visible text where you can.

aria-labelledby

Point at text that is already on screen, so the name and the visible label cannot drift apart:

<div role="dialog" aria-modal="true" aria-labelledby="dlg-title">
  <h2 id="dlg-title">Delete project</h2>
  ...
</div>

It can combine several IDs, including the element’s own, to build a fuller name:

<h3 id="plan-pro">Pro plan</h3>
<a href="/checkout/pro" id="buy-pro" aria-labelledby="buy-pro plan-pro">Buy now</a>
<!-- Announced as "Buy now Pro plan, link" -->

The referenced text is used even if that element is hidden with hidden or display:none, which is handy for a label you do not want to show. Two limits: it is not followed more than one step (an element referenced by aria-labelledby does not contribute its own aria-labelledby), and every ID must exist, or that part of the name is silently dropped.

aria-describedby

Descriptions add detail after the name, role and state:

<label for="pw">Password</label>
<input id="pw" type="password" aria-describedby="pw-hint pw-error" aria-invalid="true">
<p id="pw-hint">At least 12 characters.</p>
<p id="pw-error">Password is too short.</p>

A screen reader says something like “Password, edit, invalid entry. At least 12 characters. Password is too short.” Users can turn descriptions off or move on before they finish, so do not put the only copy of essential information in a description. A newer attribute, aria-description, takes a string instead of an ID. It is in the ARIA 1.3 draft and support across screen readers is still uneven, so prefer aria-describedby with visible text.

Where aria-label does nothing

WAI-ARIA 1.2 prohibits naming some roles. Browsers and screen readers may drop the label or read it unpredictably. The ones that matter most in practice:

  • A plain <div> or <span>, which has the generic role.
  • role="presentation" and role="none".
  • Text-level roles: paragraph, code, strong, emphasis, subscript, superscript, insertion, deletion and caption.

If an element needs a name, it needs a role that can carry one. Often the honest fix is to make it a real <button>, <a>, <section> or <img>.

Common mistakes

  • Label that contradicts the visible text. A button that shows “Search” but has aria-label="Find products" fails 2.5.3 Label in Name, because voice-control users say what they see.
  • aria-label on every link.Overriding good link text with long labels makes pages slower to use. Fix vague text like “Read more” by writing better text, or add the subject with aria-labelledby or visually hidden text inside the link.
  • Duplicating a native label. An input with both <label> and an aria-label uses only the aria-label. Remove one.
  • Broken ID references. Generated or duplicated IDs (common in components rendered twice) leave the name empty. Check that every referenced ID is unique and present.
  • Redundant role words. aria-label="Menu button"is announced as “Menu button, button”.

Missing or wrong names on controls are failures of 4.1.2 Name, Role, Value.

React, Angular and Vue

React keeps ARIA attributes hyphenated, unlike most JSX props:

<button type="button" aria-label="Close dialog" onClick={onClose}>
  <XIcon aria-hidden="true" />
</button>

// Generate stable IDs for aria-labelledby and aria-describedby
const hintId = useId()
<input aria-describedby={hintId} />
<p id={hintId}>At least 12 characters.</p>

Angular needs attribute binding for dynamic values:

<button type="button" [attr.aria-label]="closeLabel">
  <mat-icon aria-hidden="true">close</mat-icon>
</button>

<section [attr.aria-labelledby]="headingId">
  <h2 [id]="headingId">Billing</h2>
</section>

Vue binds them like any attribute: :aria-label="closeLabel". In every framework, make sure IDs are unique per component instance. More patterns are in our React, Angular and Vue guides.

How to test it

  1. Open the browser’s accessibility inspector (Chrome and Edge: Elements, then Accessibility; Firefox: Accessibility panel) and read the computed name and description.
  2. Run an automated check. axe and Lighthouse flag empty names, broken ID references and prohibited aria-label use.
  3. Listen with a screen reader. Tab through with NVDA or VoiceOver and confirm each control is announced the way its visible label reads. Our screen reader testing guide covers the commands.
  4. Try voice control. Say the visible label (“click Search”) in Voice Control or Dragon. If nothing happens, the name does not contain the label.

Frequently Asked Questions

What is the difference between aria-label and aria-labelledby?

aria-label gives an element its accessible name as a string written in the attribute. aria-labelledby points to the ID of one or more other elements and uses their text as the name. Prefer aria-labelledby when the label text is already visible on the page, because the name then stays in sync with what sighted users read and is translated with the page. If both are present, aria-labelledby wins.

Does aria-label work on a div or span?

Not reliably. A div or span with no role has the generic role, and WAI-ARIA 1.2 prohibits naming it. Some screen readers ignore the label and others read it inconsistently. Give the element a real role first (a button, a region, a group, an image) or put the text in the content instead.

Should I use aria-label or title?

Use visible text first, then aria-labelledby, then aria-label. The title attribute is the last fallback in name computation, shows only on mouse hover, never appears for keyboard or touch users, and is read inconsistently. Do not rely on title for anything people need.

Does aria-label override the text inside a button or link?

Yes. aria-label replaces the name a button or link would otherwise get from its content. That is why aria-label="Close" on a button that visibly says "Cancel" is a WCAG 2.5.3 Label in Name failure: a voice-control user who says "click Cancel" cannot activate it. Keep the visible words in the accessible name, ideally at the start.

How do I add aria-label in Angular?

Use attribute binding for dynamic values: [attr.aria-label]="label". A static value needs no binding: aria-label="Close dialog". For aria-labelledby and aria-describedby, bind the ID the same way: [attr.aria-labelledby]="titleId".

Is aria-describedby read automatically?

Usually, but after the name, role and state, and sometimes after a pause. Some users turn descriptions off. Use it for supporting information such as a password rule or an error message, never for the only copy of something essential.

Essential Accessibility Resources

Comprehensive tools, checklists, and guides to help you create inclusive digital experiences

Top Pick

Accessible Name Previewer

See what a screen reader or AI agent will call every control in your markup
accessible name
aria-label
screen reader
+2 more
View tool
Top Pick

WCAG 4.1.2 Name, Role, Value Guide

Complete guide to name, role, state, and value for UI components: accessible name computation, native HTML vs ARIA, code examples, common failures, and testing
name role value
accessible name
aria-label
+3 more
View guide
Top Pick

ARIA Roles & Attributes Reference

Interactive WAI-ARIA reference with searchable roles, attributes, live playground, screen reader behavior, and copy-paste patterns
aria
aria-label
aria-labelledby
+1 more
View guide
Top Pick

How to Use ARIA: Roles, States & Properties

The cornerstone guide to using ARIA correctly: the five rules of ARIA, when native HTML wins, roles vs states vs properties, accessible names (aria-label vs aria-labelledby vs aria-describedby), landmark roles, the aria-hidden traps that break keyboard users, live regions, and the most common ARIA mistakes, mapped to WCAG 2.2
how to use aria
using aria
aria-label vs aria-labelledby
+2 more
View guide
Top Pick

Screen Reader Testing: Complete Guide for Developers

Learn how to test your website with screen readers like NVDA, JAWS, and VoiceOver. Comprehensive guide with practical tips and testing strategies.
screen
reader
testing:
+1 more
View article

WCAG 3.3.2 Labels or Instructions Guide

Complete guide to accessible form labels: the four label association methods, why placeholders fail, required and format hints, code examples, and testing
accessible forms
aria-label
aria-describedby
View guide