Valid HTML is the best practice when it comes to websites. Though it can be difficult, it is worth the time. If your code is valid, it won’t have to be auto-corrected by browsers and it won’t cause problems with search engine robots.
I’ve talked about browser ubiquity testing before and the importance of working out problems with code to make sure a site renders correctly in browsers. To sum up, when code is written correctly a web browser doesn’t have to interpret and correct it.
If web browsers can do their own code correction, why is validating the code important? Browsers can correct code, search engine robots cannot. They are left to fend for themselves without that advanced feature. This can cause problems with them parsing your site in full and finding all the content on a page. The spiders may get stuck on a piece of messed up code and stall which will eat up the time they have to spend on your site.
There are several tools available to help validate your code and the best one comes from the W3C (World Wide Web Consortium). The W3C is in charge of writing standards for web code and has played a key role in the development of the internet as we know it. They know what they are talking about.
Correcting the code can be a real headache if you’re not really good at coding so I recommend contracting a web developer to help. A good web developer is an expert in this kind of thing and the process will take a lot less time than a novice trying to work it out.