Validate HTML Code - HTML Code Validators
What HTML Code Validators Do
If your web pages don't validate chances are they won't render properly in all the browsers. Use one of the many HTML code validators available to validate HTML code for each web page in the website. If the web page HTML code is correct it doesn't take much time to validate HTML code.
HTML Code Validators Available
There are various HTML code validators available on the net. I use and recommend the W3C's free HTML validation services to validate HTML code. There are 3 choices, you can validate HTML code by using the url of the page, validate HTML code by using uploading from your computer or by entering HTML code into the interface.
Note: The upload from your computer service will not work if you use Internet Explorer and have XP SP2 installed. After XP SP2 Internet Explorer sends the page in a format that the HTML code validator does not understand. This is a Internet Explorer problem not a problem with the HTML code validator. See the W3C Question and Answer page for ideas how to resolve this issue. If you use another browser it will work fine.
Something you have to understand is, programs take time to write and update. Other HTML code validators online and downloadable programs may not be testing for the latest standard. The W3C group wrote the standards and created the validators available through their site and why I reccommend using their services to validate HTML code.
Using the W3C's Validation Services
To use the W3C's validation services to validate HTML code the DOCTYPE declaration is required. This goes at the very top of your HTML coding. To learn more about where the DOCTYPE declaration goes, see our HTML Document Structure article. The DOCTYPE declaration sets what HTML specification standard the document is coded for so the browsers and validators know how to process HTML code.
Leave the following items at their default:
- Character Encoding
Will check that you included the character encoding meta tag and if it is coded correctly.
- Document Type
Will check you have included the DOCTYPE declaration and that it is coded correctly.
- List Messages Sequentially
Leave this set at sequentially if you are a beginner. It will make it easier to find your errors when listed in order from top to bottom of the document.
In each of the versions click the following boxes:
Will display HTML source code (HTML coding) of the document validated and links will appear beside the error message that when clicked will take you to the line that contains the error making it easier to see what the problem is. Note: The error maybe above the line indicated. If there is an error previous to this line it confuses the HTML validator. Validate HTML code each time you make a correction.
Generates an outline of the document from the heading elements (H1-H6). This will show if your heading tags are in the correct order. An important issue from an assessibility point of view.
Next, click the Check button.
If the web page uses valid HTML coding for the DOCTYPE declaration specified the HTML validator results will say "This Page Is Valid XXXXX!" (XXXXX will be name of HTML standard the HTML validator tested for).
You will notice that some websites have an image that looks like (or similar to) this:
This sample image indicates that the page uses valid XHTML 1.0 code.
Once your pages validate you can also add the appropriate image to the page. The instructions will appear on HTML validator results page for inserting the image. The guidelines for image use are available at My document is valid, can I use your valid icon?
My Page Won't Validate!
If you see the message "This page is not Valid XXXXX!" (XXXXX will be the name of HTML standard it was tested for) then the HTML validator found that there are HTML coding errors.
Look below this message and there will be a list of errors contained in the page and a link to the line containing HTML code error.
- Did you type all HTML tags and HTML code correctly?
- Did you manually enter all HTML tags? If you copied and pasted the tags then quite possibly in the process characters that the validator does not understand were added.
Fix one error at a time. Sometimes fixing one error will correct a whole pile of other errors. This is because the parser gets confused when you do not code correctly. Validate HTML code each time a correction is made.
Sometimes the line indicated does not contain an error. This is because somewhere above this line there is HTML code error(s) and the HTML validator has become confused. Look at your HTML code above this line one line at a time to find the error.
"Fatal Error: No DOCTYPE specified!"
You forgot to add the DOCTYPE declaration at the top of your HTML coding or you did not type it correctly, try retyping it.
Related Code Validators
- CSS Code Validators What CSS code validators do, CSS code validators available, using the W3C's CSS Validation Services and why your page won't validate.
- Link Validators What link check validators do, link check validators available, using the W3C's Link Checker Services and what to do when the link checker finds broken links.