Result

HTML Minification Tradeoffs

HTML minification removes whitespace between tags, optional closing tags, and quotes around boolean attributes. Gains are typically modest (5-15% reduction) compared to CSS/JS. Aggressive minification that removes </p> or </body> closing tags can break browser rendering — HTML parsers are lenient but not infinitely so. Modern static site generators (Hugo, Next.js) produce minified HTML by default during build.

CLI Equivalent

npx html-minifier --collapse-whitespace --remove-comments index.html