CSS HTML Validator - The All-In-One HTML, CSS, Link, SEO, spelling, and Accessibility Checker
Home htmlval Documentation

Documentation for htmlval for Linux and Mac

Use the new command line (console) tool htmlval to check HTML, CSS, and JSON documents on Linux and Mac. This program is based on the core validation engine in CSS HTML Validator for Windows, which was ported to Linux and Mac.

Note that some features like link checking, spell checking, PHP syntax checking, JavaScript checking, and some other features are currently not available in the htmlval port. This is a command line tool for Linux and Mac; there is no GUI like in the Windows version.

Download htmlval FREE Trial

Current trial version: htmlval for Linux Trial 2023 (v23.0022)

Download htmlval for Linux FREE TrialHow to Install

Current trial version (arm64/M1/M2/Mx): htmlval for Mac (ARM) Trial 2023 (v23.0030)

Download htmlval for Mac (ARM) FREE TrialHow to Install

Current trial version (Intel/x86_64): htmlval for Mac (Intel) Trial 2023 (v23.0022)

Download htmlval for Mac (Intel) FREE TrialHow to Install

The free trial of htmlval is fully functional (with no time limit) except for the maximum number of errors and warnings being locked to 10 each.

About htmlval for Linux and Mac

For specific information (such as download, install, and uninstall info) about htmlval for Linux or htmlval for Mac, please see the htmlval for Linux or htmlval for Mac page.

[ To the top ]

Help and Version Information

Use --help (or -H) or --version (or -V) to get a quick summary of commands or the version information and copyright notice.

$ htmlval --help $ htmlval --version

[ To the top ]

Validating Documents

To validate a document, simply use htmlval and provide it the path to the document to validate. You can validate/check HTML, CSS, and JSON documents.

$ htmlval document.html $ htmlval styles.css $ htmlval data.json

You can also specify more than one document to validate.

$ htmlval document.html styles.css

JSON Lines and NDJSON syntax checking is also supported. Ensure that the filename has a file extension of jsonl for JSON Lines or ndjson file extension for NDJSON for automatic detection of these file types.

$ htmlval data.jsonl $ htmlval data.ndjson

[ To the top ]

Validation Control

There are several options to control the validation scope. These include (but are not limited to):

For example, to validate a document with accessibility checking enabled:

$ htmlval -a document.html

To set the WCAG2/2.1 conformance level to 3, you can use (using --wcag2=NUM automatically turns on accessibility checking so also using -a is not needed):

$ htmlval --wcag2=3 document.html

[ To the top ]

Message Output Control

By default, only error and warning messages are shown (with some exceptions). If you want to see only error messages then you can use the -e or --errorsonly option. If you want a full validation with all validator messages, you can use the -f or --full option.

$ htmlval -e document.html $ htmlval --full document.html

If you want shorter (terse) validator messages, then you can use the -s or --short option. This option is good for more experienced developers who don't need all the details provided in the longer, extended messages.

$ htmlval -s document.html

If you want shorter (terse) validator messages and only error messages, then you can combine the -s and -e options together like this:

$ htmlval -es document.html

If you want the validator messages in a simple list, then you can use the -l or --list option. You can optionally use the --format option to control the message format (see the XML Message Format Variables help topic for more information). The default message format is: %Type%%where2%: %category2%%msgtext%.

$ htmlval -l document.html

Many (but not all) validator messages have a unique message ID. If you know the message ID of a validator message that you don't want to see, then you can disable the message using the --nomsgid option. Just set it to a comma-separated list of message IDs that you want to disable.

$ htmlval --nomsgid=2022123456,2022123457 document.html

Note that you can combine multiple single letter options that begin with a single dash. For example, you can combine -e, -m, and -s into -ems. Commands that begin with two dashes (i.e. --errorsonly, --nomobile, --short, etc.) cannot be combined in the same way.

[ To the top ]

JSON and XML Output

Use the -j or --json option to get the validator messages in JSON.

$ htmlval -j document.html

You can redirect the JSON to a file like this:

$ htmlval -j document.html >output.json

Similarly, you can use the -x or --xml option to get the validator messages in XML.

$ htmlval --xml document.html

[ To the top ]

Validating http/https URLs

If you have curl then you can use it to validate URLs by piping the output of curl to htmlval.

$ curl https://mywebsite.com | htmlval

[ To the top ]

Using .veo Files

A .veo file is an export of validator options from the Validator Engine Options in the Windows version. This file can be used with htmlval. Note that options in the .veo file will override options on the command line, and not all options supported by the Windows version are supported by htmlval (unsupported options will be ignored).

$ htmlval --veo ./path/myveofile.veo document.html

[ To the top ]

User Function Files (Advanced)

You can use the same user function files that CSS HTML Validator for Windows uses by specifying one or two user function files with the --uf and --uf2 options. User function files allow for advanced customization of the validation and its output. Visit the TNPL scripting help topic for more information.

Add the --danger option (only if needed) to enable potentially dangerous TNPL functions like writeFile() and deleteFile().

$ htmlval --uf ./path/myuserfunctions.txt document.html

[ To the top ]

About the cfg File (Advanced)

The cfg file (i.e. htmlvalV230.cfg) is required and is the same file used in the Windows version. It's a binary file and is not user-editable except by using the Configuration Editor in the Windows version. However, we do not recommend editing this file, but if you want to edit it anyway then you could do so using the Windows version.

The edited cfg file could then be used with htmlval to override the default file (i.e. htmlvalV230.cfg). You can specify the config file for htmlval to use with the --cfg [FILE] option.

$ htmlval --cfg ./path/myconfig.cfg document.html

[ To the top ]

Buy a License for htmlval for Linux and Mac

If you like what you see and would like to buy a license and support continued development of htmlval, then you can buy a license for CSS HTML Validator Pro for Windows or CSS HTML Validator Enterprise for Windows. These editions include htmlval. Note that htmlval is not included with the Home edition.

You can also buy an htmlval-only license for $69 $49 (INTRO OFFER) which includes only the command line (console) tool for both Linux and Mac. IMPORTANT: This htmlval-only license does not include the Windows GUI app.

[ To the top ]