Are there any command line validation tools for HTML and CSS? [closed]

There is tidy for HTML. It's more than a validator: it doesn't only check if your HTML is valid, but also tries to fix it. But you can just look at the errors and warnings and ignore the fix if you want.

I'm not sure how well it works with HTML5, but take a look at Wanted: Command line HTML5 beautifier, there are some parameter suggestions.

For CSS there is CSSTidy (I have never used it though.)

Regarding the W3C validator: if you happen to use debian/ubuntu, the package w3c-markup-validator is in the repositories and very easy to install via package management. Packages for other distos are also available.

And the W3C CSS validator is available as a jar, which is easy to use:

java -jar css-validator.jar http://www.w3.org/. 

One of the most popular web-based validators is http://validator.nu.

On their About page, they list a command-line script (written in Python) for validation.


On Ubuntu, you can install the package w3c-markup-validator. It provides a CGI web interface. But you do not have to use it.

You can use my w3c-validator-runner to run the validator without having a webserver.

If that does not work, consider starting a webserver. You can then use srackham/w3c-validator.


WC3 has the source to their validators here: https://github.com/w3c