HTML Tidy is a tool for checking and cleaning up HTML source files. It is especially useful for finding and correcting errors in deeply nested HTML, or for making grotesque code legible once more.
Project URL, source code and executable downloads: http://tidy.sourceforge.net/
I installed it on CentOS 4.6 by following the below steps, it should work fine on any Linux distro
Step 1: Go to http://tidy.cvs.sourceforge.net/viewvc/tidy/tidy/ and click on “Download GNU tarball” at the bottom. This will download a file named `tidy.tar.gz`.
Step 2: Untar the file by below command
tar xvzf tidy.tar.gz
Step 3: Change directory to the generated folder
Step 4: Run the below commands
Step 5: Tidy has been installed successfully, you can check the version by
Output: HTML Tidy for Linux/x86 released on 25 March 2009