An HTML validator is a specialized program or application used to check the validity of HTML markup in a Web page for any syntax and lexical errors. This is because HTML is not compiled and it is a very forgiving language in terms of errors; everything still works in a way, so there is no quick way to check for such errors. Hence, a separate program is required.
Techopedia explains HTML Validator
An HTML validator parses and tokenizes each line of code to check for syntax errors such as elements missing delimeters or other required parameters. Syntax errors such as open tags, misspellings, forgotten quotation marks, colons or equal signs still allow a Web page to be rendered, but the output may be different from what the designer originally intended because some of the tags and/or elements may not work as expected.
An HTML validator basically checks whether the HTML and CSS codes in a Web page comply with the standards set by the World Wide Web Consortium (W3C). An example of an HTML validator is the W3C’s own Validator Suite found at http://validator.w3.org/. There is also a CSS validator, called Jigsaw, found at http://jigsaw.w3.org/css-validator/.