4

I've been reviewing the speed of a site using Google PageSpeed, and one of the things it told me to do was minify the HTML of the page.

I'm fine with this, but by minifying the HTML (or any other markup or language) it begins to obfuscate it.

Could minifying the HTML of a page, although making the page faster, have a negative effect on how the search bot can read my page, and thus how well the site will rank?

  • 3
    Minifying html does not obfuscate it. You'll be fine. – John Conde May 15 '16 at 20:23
  • 3
    "begins to obsfucate it" - only to humans. Do you think that Google themselves might give bad SEO advice? – MrWhite May 15 '16 at 20:31
6

This is a good question, but the answer is no - it will not affect your search engine rankings negatively. It will provide a (marginal) benefit due to decreased file size.

To understand why it won't negatively affect you, open your site up, right click anywhere, and select "Inspect element" (this option will be called something slightly different between different browsers, and is distinct from "View source" in that it shows you the source of your page after processing by the browser).

Now turn your HTML minification on, and do the same thing. Does it look any different? While you'll notice the classic View source option shows code that is a bit more unreadable to you, viewing the processed source will be no different.

The point here is that once the browser has parsed the HTML, whether it's minified or not, it's all the same. A search engine bot will also work the same way. Line breaks and indentation in an HTML document are simply for human readability - your original code needs to be readable by humans, but the resulting code once it's processed can be compressed as much as you like - the browser, the bots, any other machine cares only for code, not presentation.

  • 3
    It will provide a (marginal) benefit .... True for the most part, but if the OP had HTML previously with tons of comments and/or whitespace and he goes and minifies the HTML, then the benefit can be significant. – Mike May 16 '16 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.