About the HTML Minifier
Whitespace in HTML is not always removable. Between two inline elements, as in <b>Hello</b> <i>world</i>, a space is rendered on screen. This minifier collapses every run of whitespace to a single space and removes it completely only next to block-level and metadata elements such as <div>, <p>, <li>, <head> and <meta>, where browsers ignore it anyway. The content of <pre>, <textarea>, <script> and <style> is never collapsed.
Comments are removed except Internet Explorer conditional comments (<!--[if lt IE 9]>), which some e-mail templates still depend on. Tags are tidied: extra spaces between attributes are removed, while attribute values stay exactly as written. With Minify inline CSS the <style> blocks go through the CSS Minifier; with Minify inline JS classic and module <script> blocks go through Terser, and JSON-LD blocks are compacted. A script that fails to parse is left untouched and noted in the status line.
Server-side templates (Handlebars, Jinja, PHP) usually pass through intact, but check the result if tags are generated dynamically. The status line shows original, minified and gzip sizes. Processing happens in your browser.
How to use it
- Paste HTML or open an .html file.
- Choose whether to remove comments and minify inline CSS and JS.
- Compare the sizes in the status line.
- Copy the output or download index.min.html.