Heads up! This blog post hasn't been updated in over 2 years. CodePen is an ever changing place, so if this post references features, you're probably better off checking the docs. Get in touch with support if you have further questions.

Deque Systems makes an open source project called aXe:

The Accessibility Engine for automated testing of HTML-based user interfaces. Drop the aXe on your accessibility defects!

There are a variety of ways you can use it, like a browser extension for Chrome or Firefox. It’s also just a stand-alone library, which is a smart move as it means the functionality of aXe is portable to all these different places.

To use it on a Pen, it’s as simple as including the library, like as an External Resource:

https://cdnjs.cloudflare.com/ajax/libs/axe-core/2.4.2/axe.min.js

Then calling it in your JavaScript:

axe.run(function(err, results) {
  console.log(results.violations);
});

Here’s an example Pen where you can see it find errors.