The W3C Validation Service validates multiple versions of XHTML and HTML, outputting many useful errors and warnings to help users create a standards-compliant web page.
HTML Tidy is an open source program and library for checking and generating clean XHTML/HTML. Binaries and source for a variety of platforms are available for download.