11

What happens when I minify my HTML in SEO terms? I mean, I minified my HTML which means that every <meta... /> tag is being placed on one line.

Will this affect my SEO at all?

2 Answers 2

22

Only in the sense that your page will download faster and Google gives you points for that because a faster page load is a better user experience. Otherwise, minimizing your page has no other impact.

13
  • 1
    Google reads web pages by tag order, not by line endings or whitespace position, so a properly formatted html stream will read the same whether it is minified or not. Just faster when minified as there's less data. The only time it makes a difference is if Javascript comes unglued because certain formatting was ignored. If you are the type who follows C style programming conventions, this usually isn't an issue, if you're using the "leave just about everything out possible" Basic style program formatting, interesting things happen during minification. Commented Jan 1, 2016 at 23:38
  • 1
    If you really want faster loading speeds, one would remove bloat from their webpage (remember when pages were less than a megabyte?) and use compression
    – Cole Tobin
    Commented Jan 2, 2016 at 6:00
  • @ColeJohnson how do you compress a HTML document?? :/
    – undo
    Commented Jan 2, 2016 at 9:08
  • 1
    You need to configure the webserver to use something like gzip when serving the pages. It will do the compression for you. Commented Jan 2, 2016 at 9:34
  • 2
    It should be noted that speed is a minor factor in SEO. And once you're using gzip, minifying on top of that makes very little difference. Commented Jan 3, 2016 at 16:47
1

In addition,

Minifying a resource, be it a CSS, JavaScript, or HTML file—is simply the process of removing spaces, comments, tabs, and other unnecessary code in the file.

There are many tools available for minification.

  • Use Google’s Closure Compiler for JavaScript, YUI Compressor for CSS, and an HTML minifier for HTML. Again, it’s easiest to simply download the minified versions of the files PageSpeed Insights provides.

  • If you’re running any CMS, you can take advantage of the
    minification by many plugins.

Google watches code. Not spaces between it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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