Pa11y CI, axe-core or Lighthouse CI: which to use as an accessibility gate
Three free, well-maintained tools can fail a build on accessibility problems, and for many teams one of them is enough. The useful question is not which detects more, but what each does when the first run finds fifty violations.
Detection is mostly the same engine
Before comparing, one fact that removes most of the argument: three of the four options below run axe-core, the open-source engine from Deque. Pa11y CI can run it as an alternative to its default engine, Lighthouse's accessibility audits are built on it, the axe CLI is it, and Skiplink runs it unmodified. None of them detects a violation the others cannot, given the same rules on the same page.
So the choice comes down to three other things: what the tool fails the build on, where it runs, and how much glue you are willing to write.
Pa11y CI
Pa11y CI (opens in a new tab) runs Pa11y against a list of URLs from a config file and exits non-zero when it finds errors. Its default engine is HTML_CodeSniffer; it can run axe-core instead, or both.
What it fails on is a count. --threshold permits a number of issues before the run
fails, and you can ignore issue codes to silence them. It runs on your own machines, and
Pa11y can script actions before testing (clicking, filling fields), which is how teams
reach pages behind a form. It is LGPL-3.0 licensed.
Good fit: a team that wants a self-hosted check with a simple config file, especially on a site that is already close to clean.
The axe CLI
@axe-core/cli (opens in a new tab) drives a real browser
against a URL and reports axe-core's findings. With --exit it returns a non-zero code
when there are violations, which is all a CI step needs. --tags, --rules and
--disable narrow the run.
What it fails on is any violation. That is the right behaviour for a site that already passes, and the wrong one for a site that does not: there is no notion of "already known", so the first run is red and so is every run after it until everything is fixed.
The same engine is also available inside test runners, such as @axe-core/playwright,
where you call it on a page your test has already set up.
Good fit: greenfield projects, or any codebase where the debt is already paid down.
--exit in a workflow step is free and finished.
Lighthouse CI
Lighthouse CI (opens in a new tab) runs Lighthouse against your URLs and checks the results against assertions in a config file. For accessibility that usually means an assertion on the category score, for example a minimum of 0.9, or on individual audits. The accessibility score is a weighted average of Lighthouse's accessibility audits, weighted by axe's user-impact assessments. An optional server keeps history.
What it fails on is a score or an audit. A score is a reasonable thing to watch over time and a weak thing to gate on: fix one problem and introduce another of similar weight and the number barely moves. Asserting on individual audits is stricter, but then it behaves like the axe CLI, with the same first-run problem.
Good fit: a team that already runs Lighthouse CI for performance budgets and wants an accessibility trend next to them.
Side by side
| Engine | Fails on | Runs | |
|---|---|---|---|
| Pa11y CI | HTML_CodeSniffer by default; axe-core optional | A count, with a threshold and ignored codes | Your machines |
| axe CLI | axe-core | Any violation, with --exit | Your machines |
| Lighthouse CI | Lighthouse audits built on axe-core | Assertions on the score or on audits | Your machines; optional history server |
| Skiplink | axe-core, version reported on every result | Violations not in a committed baseline | Our infrastructure; adapters run in your tests |
The problem none of the free tools set out to solve
Point any of these at a site that has been live for a few years and the first run finds dozens of violations. A gate that fails every build is switched off within days. The two usual workarounds both have a cost:
- A threshold counts. It cannot tell a violation you fixed from one you introduced, so the gate stays green while the site gets a new problem.
- Ignoring rules silences them everywhere, including on the page someone writes tomorrow.
A baseline is a third approach: each violation gets a fingerprint, the accepted ones are committed to the repository, and the gate fails only on fingerprints that are not in the file. That is what Skiplink sells. You can build the same thing on top of any of the tools above with a script that diffs JSON output against a committed file; the hard parts are making the identity survive a class rename and not letting one accepted entry absorb new violations that share its text. Checks in CI on an existing site explains how ours handles both.
When to use which
- Your site already passes: the axe CLI with
--exit, or axe-core in your existing tests. Nothing to baseline, nothing to pay for. - You want one number on a dashboard: Lighthouse CI, alongside the performance budget you probably already have.
- No third party may see your URLs: Pa11y CI or the axe CLI. A hosted scanner is the wrong shape, and no argument fixes that.
- An existing site with real debt, and you want the next regression to fail the build: a baseline, whether you build it or use ours. Skiplink's GitHub Action is a few lines of YAML, and the Playwright adapter shares the same baseline file for pages behind a login.
If you do leave, the baseline is plain JSON in your repository. Our comparison page says the same thing at more length, including when not to choose us.
What every one of them misses
All four check what a machine can check. None of them can tell whether alt text describes the image, whether focus order makes sense, or whether a custom widget behaves the way its role promises. A passing gate, from any of these tools, means no automatically detectable violations were found, not that the site conforms to WCAG. The criteria no scanner detects are listed in our reference, and what a scan does not tell you has the rest.
Related
- Alternatives: Pa11y CI, Lighthouse CI and axe CLI
- Accessibility testing in GitHub Actions: a working workflow in five minutes
- Adding accessibility checks to a site that already has violations
Try it on your own site: scan a URL for free, or read the docs to add a baseline to your pipeline.