Validation means checking whether a page is free of errors, using a computer program. HTML Validation refers to the procedure of checking whether the html code on a web page complies with the HTML Standards, as set by the W3C Consortium. Imagine it like comparing a sentence to the rules of grammar that apply to the language that the sentence is written in.
Search Engine Visibility
When search engines crawl you website pages in order to index them, they check for errors and make certain decisions about them. If pages in your website contain errors, crawlers might not be able to read part of the content, or your pages might end up not being indexed at all. So the safest way to make sure that all your pages get indexed, is to validate them and fix any html errors. Furthermore make sure that you don’t have any broken links, broken redirects or bad grammar, which reduce the quality score of your website.
Keeping your visitors
If your website contains errors, they will probably cause problems in the whole experience a visitor is having when browsing through it. The next website is always a click away.
Not all browsers across all devices handle errors with the same way. Some browsers can be forgiving, and some might not. So even if most browsers do a good job in handling most of the errors, its best to use standard markup and stylesheets. And this is where validation comes into play.
Future-proof quality check
Validation helps a web developer to check whether a page is build according to Web Standards, therefore making it safer that it will perform as it was designed to in future Web Platforms/Browsers.
It’s easier to maintain a page if its build using standards as HTML and CSS, which are a form of widely accepted “coding style”.
Teaches good practices
Validating a page helps beginners and students to easier find a mistake, and introduces them to new concepts, such us accessibility.
A sign of professionalism
Validation can be used as a way to check whether the page was created by a web professional (using semantic and well-formed markup, separation of style and content and other techniques), or a beginner with no knowledge of the above.
If you validate your code it will make it easier for text readers to present your information to the visually impaired and those using special devices to surf the web.
What won’t validate?
• Browser hacks
• Custom attributes
• Genuine errors, such as unclosed elements
• ARIA roles.
What to use validation for
1. Testing for unclosed HTML elements, such us <div> or <p>
2. Checking for typos
3. Making sure that you have not omitted any semicolons.
How often to validate?
Some people validate each time they make a minor change to their code, and some validate when they make a major change. Always remember to validate after finishing the development of your project, before taking it live. That way you will fix all the errors, and then next time you make a change to your code, you won’t probably find an error.