axe-core

Also known as: axe

On this page 8

axe-core is an open-source JavaScript accessibility rules engine that runs inside a browser page, inspects the rendered DOM and reports elements that break WCAG success criteria or accessibility best practices. In web testing, it is the most widely embedded engine for automated accessibility checks, powering browser extensions, Lighthouse audits and test-framework plugins.

Developed by Deque Systems and released under the Mozilla Public License 2.0, axe-core is often called simply axe. Its design goal is no false positives: a rule reports a violation only when the engine is confident, and uncertain cases are flagged for human review instead.

How axe-core evaluates a page

axe-core works on the live, rendered document, not on source files. After the script is injected, a call to axe.run() walks the DOM, computes styles, accessible names and roles, and applies each enabled rule to the matching elements, including content inside open shadow roots and same-origin frames.

Each rule is built from checks grouped as any, all and none conditions. A rule such as color contrast selects text nodes, calculates foreground and background colors and compares the ratio with the 4.5:1 threshold for normal text. The engine then sorts every evaluated node into one of four result groups.

Result groupMeaningRecommended action
violationsRule failed with high confidenceFix the element and rerun the test
incompleteEngine could not decide, for example text over an imageReview manually
passesRule was applied and the element met itNo action, useful as coverage evidence
inapplicableNo element matched the ruleNo action needed
Result groups returned by axe.run

The incomplete group is frequently ignored, which is a mistake. It often contains the contrast and ARIA cases that most need a human decision.

Rules, tags and impact levels

axe-core ships with roughly 90 to 100 rules, depending on the version, and each rule carries tags that map it to standards. Tags let teams run only the rules that match their compliance target.

TagScopeTypical use
wcag2aWCAG 2.0 Level AMinimum legal baseline
wcag2aaWCAG 2.0 Level AAMost regulatory targets
wcag21aa / wcag22aaCriteria added in WCAG 2.1 and 2.2Current procurement requirements
best-practiceGuidance beyond WCAGQuality checks such as landmark use
experimentalRules still under evaluationDisabled by default
Common rule tags and their purpose

Every violation also has an impact level of minor, moderate, serious or critical. Impact describes the likely effect on users, for example a missing form label is usually critical, while it does not reflect legal priority. Many teams fail the build only on serious and critical issues at first and tighten the gate over time.

Integrations in the web testing stack

axe-core itself has no user interface and no test runner; it is a library that other tools wrap. This is why the same rules appear in very different places, from a developer’s browser to a continuous integration pipeline.

IntegrationWhere it runsBest suited for
Browser extensionBrowser DevTools panelManual spot checks during development
LighthouseChrome and PageSpeed InsightsQuick accessibility score with a subset of rules
Playwright or PuppeteerHeadless browser in end-to-end testsChecking full user flows and page states
Cypress pluginCypress test runnerComponent and page tests in one tool
jest-axeJest with a simulated DOMFast unit tests of components
Command-line toolsNode.js scriptsCrawling lists of URLs
Ways to run axe-core

Unit tests in a simulated DOM have limits: jsdom does not compute layout, so rules that need rendering, especially color contrast, cannot run reliably there. End-to-end tests in a real browser engine give more complete results.

How axe-core compares with other accessibility checkers

axe-core is one of several engines used for accessibility testing, and the choice depends on how results are consumed. Its strength is embedding into code; other tools focus on visual reports or site crawling.

  • WAVE overlays icons on the page, which suits visual review by content editors more than automated pipelines.
  • Pa11y is a command-line runner that can use axe-core or HTML_CodeSniffer as its engine.
  • Lighthouse runs a selected subset of axe-core rules and converts them into a weighted score, so a score of 100 does not mean the full rule set passed.

Configuring axe-core in practice

Effective use depends on scoping the analysis and handling exceptions deliberately. axe.run() accepts a context, such as a selector to include or exclude, and options that enable tags, disable rules or set result types.

  • Run checks after each meaningful state change, such as opening a dialog or expanding a menu, because hidden content is not evaluated.
  • Exclude third-party widgets only with a tracked ticket, so excluded areas are not forgotten.
  • Pin the axe-core version in the lockfile, since new releases add rules and can break builds unexpectedly.
  • Store results as JSON to track trends across releases rather than single runs.

Limitations and common misconceptions

The most important limitation is coverage: automated engines detect only a portion of WCAG failures, commonly estimated at around a third to a half of real-world issues depending on the method of counting. axe-core cannot judge whether alt text is meaningful, whether focus order is logical or whether a screen reader experience makes sense.

IssueDetected automaticallyReason
Missing form labelYesAbsence of an accessible name is measurable
Insufficient contrastMostlyImages and gradients produce incomplete results
Meaningful alt textNoRequires understanding of image purpose
Logical focus orderNoDepends on visual layout and user intent
Keyboard trapsNoRequires interaction, not static inspection
What axe-core can and cannot verify

A zero-violation result is not proof of accessibility. It shows that the tested states passed the automated rules, and it must be combined with keyboard testing and screen reader checks.

In plain words

axe-core is like a spell checker for accessibility. It reads a web page the way a browser sees it and points out problems that would make the page hard to use for people with disabilities, such as buttons without names or text that is too faint to read.

Like a spell checker, it catches many obvious mistakes but not all of them. It cannot tell whether a picture description actually makes sense, so people still need to test the page themselves.

A real-world example

A team building an online banking portal adds axe-core to its Playwright end-to-end tests. Each test logs in, opens the transfer form, triggers validation errors and runs an analysis with the wcag2a, wcag2aa and wcag22aa tags after every step.

In the first week the pipeline reports 37 violations, mostly unlabeled icon buttons and low-contrast error text. The team fixes the critical and serious ones within two sprints and then configures the build to fail on any new serious or critical violation. A quarterly manual audit with screen readers still finds focus-order problems the engine cannot detect, but the number of regressions reaching production drops sharply.