Pa11y

On this page 8

Pa11y is an open-source automated accessibility testing tool that loads a web page in a headless browser, runs a rule engine against the rendered document and reports issues measured against the Web Content Accessibility Guidelines (WCAG). In web accessibility practice, it belongs to the family of scriptable checkers that developers run from the terminal, from Node.js code or from a continuous integration pipeline, rather than from a browser extension.

The name is a play on the numeronym a11y, where 11 stands for the letters between the first and last letter of accessibility. Pa11y is valued for being small, scriptable and free, but like every automated checker it detects only the machine-testable subset of WCAG failures and cannot replace manual review.

How Pa11y tests a page

Pa11y tests a page by rendering it in headless Chrome through Puppeteer, waiting until the document is ready and then injecting a test runner that inspects the live DOM. Because it evaluates the rendered page, it sees content added by JavaScript, computed styles and the final state of the document, not only the raw HTML returned by the server.

The default runner is HTML_CodeSniffer, a rule library that maps each check to a WCAG success criterion and technique code. Since version 5, Pa11y can also use axe-core as an alternative or additional runner, and results from both engines can be combined in one report. Each finding carries a rule code, a message, a CSS selector and an HTML context snippet, which lets a developer locate the offending element quickly.

The following table summarizes the stages of a typical Pa11y run and what each stage contributes.

StageWhat happensWhy it matters
LaunchPuppeteer starts headless ChromeProvides a real rendering engine
NavigateThe URL loads with optional headers and cookiesAllows testing of authenticated pages
ActionsScripted clicks, typing or waits runReaches states such as open menus
Run rulesHTML_CodeSniffer or axe-core inspects the DOMApplies WCAG-mapped checks
ReportIssues are formatted and returnedFeeds terminals, files or pipelines
Stages of a Pa11y test run

The Pa11y toolset and its components

Pa11y is not a single program but a small family of related packages maintained under the same project. The core package handles one URL at a time, while companion tools add batch testing, scheduling and visualization on top of it.

PackagePrimary roleTypical user
pa11yCommand-line tool and Node.js library for one pageDeveloper debugging a template
pa11y-ciTests lists of URLs or a sitemap with thresholdsBuild engineer guarding releases
pa11y-dashboardWeb interface that tracks results over timeTeam lead monitoring trends
pa11y-webserviceJSON API that schedules recurring testsPlatform team integrating tools
Main packages in the Pa11y family

In practice, pa11y-ci is the most common entry point for teams, because it reads a configuration file listing URLs, applies shared options and fails the build when the number of errors exceeds a configured threshold. The dashboard is useful for showing progress to stakeholders, although it requires its own database and hosting.

Key options, standards and result types

Pa11y behavior is controlled through command-line flags or a JSON configuration, and a handful of options decide most of what a team sees. The standard option selects WCAG2A, WCAG2AA or WCAG2AAA, with WCAG2AA as the default because level AA is the usual legal and contractual target.

OptionEffectCommon setting
standardSelects the WCAG conformance levelWCAG2AA
runnerChooses the rule enginehtmlcs, axe or both
levelSets which issue type fails the runerror
thresholdTolerates a number of issues before failing0 for new projects
ignoreExcludes specific rule codes or typesReviewed false positives
hideElementsSkips matching elements entirelyThird-party widgets
actionsScripts interaction before testingOpen a dialog, fill a form
reporterFormats outputcli, json, csv or html
Frequently used Pa11y options

Every finding is classified as an error, a warning or a notice. Errors are failures the engine is confident about, such as an image without a text alternative. Warnings and notices require human judgment, for example whether a link text is meaningful in context. The command-line tool returns exit code 2 when issues are found and exit code 1 for technical failures, which makes scripting straightforward.

How Pa11y compares with other accessibility checkers

Pa11y occupies the headless, automation-first niche among accessibility tools. It overlaps heavily with axe-core, which it can embed, and with WAVE, which serves a similar purpose through a visual browser overlay.

ToolInterfaceStrengthLimitation
Pa11yCLI, Node.js API, CISimple scripting and batch runsNo visual in-page overlay
axe-coreJavaScript libraryLow false-positive rateNeeds a host tool or framework
WAVEBrowser extension and APIVisual annotation of issuesLess suited to unattended runs
LighthouseDevTools panel and CLICombines performance and accessibilitySmaller accessibility rule set
Pa11y compared with related tools

The engines also differ in philosophy. HTML_CodeSniffer reports more notices that ask a human to verify something, while axe-core deliberately limits itself to findings with very few false positives. Running both through Pa11y gives broader coverage at the cost of more triage work.

Using Pa11y in a development workflow

Pa11y delivers the most value when it runs automatically on every change, so regressions are caught before release instead of during an annual accessibility audit. A common pattern is to add pa11y-ci to the pipeline, point it at a sitemap or a curated list of representative templates and set the threshold to zero for new code.

  • Test templates rather than every page, because one broken component usually repeats across hundreds of URLs.
  • Use actions to reach hidden states, such as expanded navigation, modal dialogs and form error messages.
  • Record ignored rules with a reason, so suppressions remain auditable and do not hide real defects.
  • Store JSON results as build artifacts, which allows trend comparison between releases.

For legacy sites with hundreds of existing issues, teams often start with a baseline threshold equal to the current count and lower it gradually. This prevents the pipeline from failing permanently while still blocking new regressions.

Limitations and common mistakes

The central limitation is that automated testing covers only part of WCAG. Estimates vary by method, but automated engines typically detect a minority of real-world barriers, often cited as roughly a third of issues. A clean Pa11y report therefore means no detectable failures, not an accessible page.

MistakeConsequenceBetter practice
Treating zero errors as conformanceKeyboard and screen reader barriers remainAdd manual and assistive technology testing
Ignoring warnings and noticesContext-dependent failures go unreviewedTriage them during code review
Testing only the home pageForms and checkout flows stay untestedCover each template and key journey
Broad ignore rulesReal defects are silently suppressedIgnore by specific code with a note
Skipping interactive statesDialogs and menus escape testingScript actions before the run
Typical mistakes when relying on Pa11y

Pa11y also cannot judge meaning and usability: it confirms that an image has alt text, not that the text describes the image, and it confirms that focus styles exist only indirectly. Focus management, tab order and reading order still require a person using a keyboard and a screen reader such as NVDA.

In plain words

Pa11y is a free program that visits a website on its own and checks it for common accessibility problems. It looks for things such as pictures without descriptions, form fields without labels and text that is too pale to read, and then prints a list of what it found.

Think of it as a spell checker for accessibility. It catches many obvious slips quickly and every time, but it cannot tell whether the writing actually makes sense. People still need to test the site the way disabled visitors really use it.

A real-world example

A regional public transport operator rebuilds its journey planner and must meet WCAG 2.1 level AA under its procurement contract. The development team adds pa11y-ci to its build pipeline with a list of twelve representative URLs, including the timetable search, the results page and the ticket checkout, each with scripted actions that open the date picker and submit an empty form.

On the first run, Pa11y reports 47 errors, most of them missing form labels in a shared search component and low-contrast text in the footer. Fixing those two components removes 38 errors across all pages in a single sprint. The team then sets the threshold to zero, so any new error fails the build automatically.

Before launch, an external auditor still finds keyboard traps in the map widget that Pa11y could not detect, which confirms that the tool reduced manual effort without replacing it.