Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools Introduction to Front End Performance Optimization Combine and Minify Assets Minify Assets

Peter Campbell
Peter Campbell
18,085 Points

HTML Minify?

Why don't we minify the HTML? It seems like an obvious step if you want to further increase performance.

2 Answers


Many reasons. First (and simplest)--minification would gain you almost no benefit with HTML. After removing a bit of white space, HTML in web pages is of negligible load.

Second, a lot of HTML is generated dynamically, on the fly, and the extra step of minifying it on the fly would negate any small benefits.

Third, most of the "weight" of an HTML page is the content, not the markup.

Given all of this, some people do minify HTML in certain situations (Google it), but it's definitely not a common (or popular) thing to do.

Hope that helps.

Ryan Ruscett
Ryan Ruscett
23,307 Points

Minify for html is in my opinion whatever lol. It good yeah but it's more about other parts of an html page or more the things that come with it I should say. For example, CSS is a big one. Take a product like IBM Web Experience Factory. It's used to develop WebSphere Portal portlets with an interactive gui. No coding required. Depending on your application, you could have tons and tons and tons of CSS. It's all auto generated for you. This is awesome, because you don't have to write it, but it easily gets out of control. Transferring that CSS and POST GET type of stuff. Can really effect performance and cause timeouts, all kinds of loading errors blah blah. So compressing your CSS is not even really an option. It's a must. So why not just compress it all. Including html. It's kind of like a Geico commercial. Minify HTML - it's just what you do, but if you want to rock you Minify it all lol.

haha does that help bring some clarity? I may of confused myself while typing that haha.