Most of the developers often wonder if Googlebot cares about valid HTML? The question was answered by Google's Head of Search Spam, Matt Cutts in his recent Webmaster video.
The question asked to Cutts was: "Does the crawler really care about valid HTML? Validating google.com gives me 23 errors, 4 warning(s)".
Cutts said, "There are plenty of reasons to write valid HTML and pay attention to your HTML and make sure it is very clean and it validates. Valid HTML makes it more maintainable, easier when you want to upgrade, much better to hand the code off to somebody else. There are good reasons to do it. At the same time, Google has to work with the web that we have and not the web that we want to have. And the web that we have has lot of syntax errors and invalid html, so we have to build the crawler to compensate with that and deal with all the errors and weird syntax that people sometimes mistakenly write in a broken way".
He said that Google doesn't penalize you if you have invalid html because there will be huge number of web pages like that. Some people know the rules and decide to make things a little bit faster or to tweak things, so pages do not validate. Matt Cutts further added, "There are enough pages that do not validate if we think are going to hurt search quality. If we said only the pages that validate are allowed to rank or rank those a little bit higher. First and foremost, we have to look at the quality of the information, whether users are getting the most relevant information that they need rather than whether someone has done a very good job of making the cleanest website. I wouldn't be surprised if they co-relate valid HTML, maybe it’s a signal we could consider in future. But, at least for now do because it's easier if you want to change the site in future, don't just do because you think it will give you higher search results".Matt Cutts on Why you Should Have Valid HTML?,