The HTML aria-level attribute
The aria-level attribute defines the hierarchical level of an element: a heading level, or the depth of a tree item or nested list. Value: an integer of 1 or more. Prefer native <h1> to <h6> for headings.
Overview
The aria-level attribute defines the hierarchical level of an element within a structure.
It states how deep an element sits in a hierarchy: the level of a role="heading" element, or the depth of a treeitem inside nested groups. Browsers already infer this from native <h1>-<h6> headings and from properly nested lists, so you only need it on custom structures where nothing native conveys the level.
Like all ARIA, aria-level changes only the accessibility tree (what assistive technology perceives), never the element's behavior or appearance. The first rule of ARIA applies: if a native HTML element or attribute conveys this, use that instead, and only reach for ARIA when nothing native fits.
Syntax
<div role="heading" aria-level="2">Section title</div>
Values
| Value |
|---|
| An integer greater than or equal to 1. |
Example
<div role="heading" aria-level="3">Custom heading</div>
Best practices
- Choose each
role="heading"level from its place in the outline, so a subsection under a level 2 heading takesaria-level="3", and don't skip levels. A heading that script inserts later needs a level that fits where it lands. - In a treegrid, the level goes on each row and not on its gridcells. On a row inside a plain table or grid, WAI-ARIA 1.2 forbids it.
- For threaded replies whose nesting isn't in the DOM, such as paginated comments, put the level on each reply's listitem so its depth in the thread is still exposed.
- After script moves a treeitem to another branch, update its level and those of its descendants. Chrome exposes the written aria-level even when the nesting implies another depth, so a stale value goes on reporting the old one there.
Frequently asked questions
What does aria-level do?
When do I need aria-level?
Do native headings need aria-level?
<h1> through <h6> already carry their level, and a native heading is always the better choice.






















