Live rework in progress.
Please report major issues.

Jens Oliver Meiert

HTML Conformance: A Comparison of 6.5 npm Validator Packages (With 1.5 Recommendations)

Published on Dec 17, 2024 (updated Jan 6, 2025), filed under (feed). (Share this on Mastodon or Bluesky?)

It’s easy to validate the output of an HTML document using the W3C HTML validator or its Validator.nu sibling. As web-based tools, they don’t require any setup.

But what if you cannot use these validators? What if you have to or choose to resort to a package? Would you even have an alternative?

I reviewed what seemed to be the six most popular validator packages on npm, plus a “static code analysis tool” for HTML, to check on how useful these actually are. (Jump to the summary if you either care about a quick comparison or snippet validation in particular.)

The Reviews

HTML-validate

W3C HTML Validator

html-w3c-validator

html-validator

The Nu Html Checker (v.Nu)

html-validator

HTMLHint

A Summary

PackageCan handle HTML–HTML?Can handle HTML snippets?Performs local validation?Maintained?
HTML-validatenoyesyesyes
W3C HTML Validatoryesnonoyes
html-w3c-validatoryesnono?yes
html-validatoryes?yesnono
The Nu Html Checker (v.Nu)yesnoyesyes
html-validator?yesyes?no
HTMLHintyesnoyesno

What is “maintained” here? Anything that received an update on npm within the last year.

You’ve seen my recommendations, but let me recap them here: Pretty much like you’d do for web-based HTML conformance checking, use the Nu Html Checker package in your Node or other JavaScript projects, too. If you need snippet or fragment validation, too, based on my experience filing issues and working with David Sveningsson, my next recommendation is HTML-validate—while it’s currently not suited for HTML–HTML validation, it may get there, and it seems pretty well-maintained otherwise.

âť§ What did I miss or mess up? Email me, or comment on the social media messages for this post (like its toot)!