How to Use Pa11y for Web Accessibility Testing

Pa11y is a free, open-source toolset for automated web accessibility testing. It scans websites to identify issues that affect users with disabilities, ensuring compliance with WCAG standards. It’s ideal for developers and designers building inclusive digital experiences.

9/1/20253 min read

white concrete building during daytime
white concrete building during daytime

What is Pa11y?

Pa11y is a free, open-source toolset designed for automated web accessibility testing. It helps identify issues that make websites less usable for people with disabilities, ensuring compliance with standards like the Web Content Accessibility Guidelines (WCAG). Pa11y is a fantastic resource for developers, testers, and designers who want to create inclusive websites that everyone can use.

What is Pa11y Used For?

Pa11y has several key uses:

  1. Finding Accessibility Issues: It scans a website’s code to detect problems, such as missing alt text for images, low color contrast, or incorrect heading structures.

  2. Ensuring WCAG Compliance: Pa11y checks if your site meets international accessibility standards, like WCAG 2.1, which is important for both ethical and legal reasons.

  3. Automating Testing: It allows regular accessibility checks within automated workflows, such as CI/CD pipelines, saving time and effort.

  4. Helping Development Teams: Pa11y generates detailed reports that guide developers in fixing accessibility issues efficiently.

By using Pa11y, you can make your website more usable for people with visual, auditory, or motor impairments while improving the overall user experience.

How to Use Pa11y?

Here’s a step-by-step guide to using Pa11y, written for both beginners and advanced users, with commands described in plain text for easy copying to your blog.

1. Installing Pa11y

Pa11y runs in a Node.js environment, so you’ll need Node.js and npm (Node Package Manager) installed on your computer.

  • Install Node.js: Visit nodejs.org to download and install Node.js if you don’t already have it.

  • Install Pa11y Globally: Open your terminal and run the command: npm install -g pa11y. This lets you use Pa11y from the command line.

  • Verify Installation: Type pa11y --version in the terminal. If it’s installed correctly, you’ll see the Pa11y version number.

2. Basic Usage of Pa11y

Once installed, you can scan a webpage by typing this in your terminal: pa11y https://yourwebsite.com. Replace “yourwebsite.com” with the URL of the site you want to test.

This will scan the page and display a report in the terminal, listing errors, warnings, and notices about accessibility. For example, it might point out missing alt text on images, low text-to-background contrast, or incorrect heading structures (like skipping an H1).

3. Configuring Tests

Pa11y lets you customize scans to fit your needs. For instance, you can specify which WCAG standard to test against (like A, AA, or AAA) or choose how to output the results.

For example, to scan a website against WCAG 2.1 Level AA and save the report as an HTML file, you can run: pa11y https://yourwebsite.com --standard WCAG2AA --reporter html > report.html. This creates a more readable HTML report that you can share with your team.

4. Advanced Usage: Pa11y in CI/CD

For teams using continuous integration/continuous deployment (CI/CD), Pa11y is a great tool to automate accessibility testing. You can integrate it with tools like Jenkins, GitHub Actions, or GitLab CI.

To scan multiple pages at once, you can use Pa11y-ci, an extension of Pa11y. For example, you can add a script to your project’s package.json file to run tests on all HTML pages of your site. The command might look like: pa11y-ci https://yourwebsite.com/**/*.html. You can trigger this script with: npm run test:accessibility. This is perfect for large websites with many pages.

5. Visualizing Results with Pa11y Dashboard

Pa11y Dashboard provides a graphical interface to view test results. To install it, run: npm install -g pa11y-dashboard. Then, start the dashboard by typing: pa11y-dashboard.

Once it’s running, you can add URLs to scan, and the results will appear in a user-friendly web interface, making it easier to review and share findings.

6. Manual Verification of Results

Pa11y is an automated tool, so it won’t catch every accessibility issue, like contextual errors in alt text. You should always verify its results manually, ideally with input from people with disabilities or by testing with screen readers like NVDA or JAWS.

How Can Pa11y Help?

Pa11y saves time by quickly identifying accessibility issues. Here’s why it’s valuable:

  • Speed: Automated scans highlight basic errors in seconds.

  • Precision: Reports show exactly where problems are in your code.

  • Flexibility: It integrates with CI/CD and lets you customize testing standards.

  • Education: Pa11y’s reports include suggestions for fixes, helping teams learn accessibility best practices.

Limitations of Pa11y

Pa11y isn’t a complete solution for accessibility. Automated tools typically catch only 30-40% of issues, and problems like usability or context need manual review. Use Pa11y alongside manual testing and expert audits for the best results.

Conclusion

Pa11y is a powerful, user-friendly tool that helps make your website more accessible. Its automated scans quickly identify issues, and its CI/CD integration fits perfectly into development workflows. However, always pair Pa11y with manual testing to ensure full WCAG compliance and a great experience for all users.