The World Wide Web Consortium sets the standards for mark-up languages like HTML, so their validation site can be considered to be the ultimate authority when it comes to syntactical correctness.
It will check HTML right up to the latest version, and XHTML too. It will also check your Cascading Style Sheets for correctness, but from another starting page.
You have various options if you want to use them - to show the source code of your page, an outline of your document and the parse tree - the detailed, logical structure of the code. You simply enter the URL of the page you want to check and a few seconds later, it comes back with a full report.
The report lists each line that it considers to have an error. Although your page may work perfectly well in your browsers, these errors refer to their compliance with W3C HTML standards, not browser compatibility, and as we know, W3C compatible browsers are very rare beasts indeed.
Common errors I found on my site are:-
The lack of a DOCTYPE statement at the top of the page - there is a pretty thorough explanation of what DOCTYPE and the different HTML levels are all about.
Widowed tags - missing end tags, especially </P>. Some ending tags are optional in current browsers and are not inserted by WYSIWYG editors.
The use of HEIGHT in inappropriate places in tables and cells. Most WYSIWYG editors let you specify HEIGHTs for tables and cells and the browsers understand them.
The use of NAME for forms and images. Most browsers can, and do use the NAME attributes.
Missing ALT tags for images. (This is sheer laziness on my part.)
Unfortunately, the W3C Validator just gives an absolute PASS or FAIL for the whole document. There are no degrees of correctness even though none of these errors cause problems with any browser that I've tested them in so far. It would be nice if there was more explanation of how to fix such errors rather than just point at `the book' and say 'go find it'.
On the whole, makes pretty depressing reading!
W3C Validator- http://validator.w3.org/