HTML Minifier
Squeeze a page down without changing how it renders.
About this converter
Collapses whitespace, drops comments and redundant attributes, and minifies any CSS and JavaScript written inside the page.
Whitespace in HTML is not always insignificant, which is the thing that makes an aggressive minifier dangerous. The space between two inline elements is the space between two words, and removing it runs them together. This collapses runs of whitespace to one but never removes it between inline elements, which is the setting that keeps a page looking the way it did.
Keeping attribute quotes is on by default. Removing them is valid HTML5 and saves a little, but the output stops being copy-pasteable into anything that expects XHTML, and the saving is small enough not to be worth the surprise.
Frequently asked questions
Will this change how my page looks?
It should not. Whitespace between inline elements is preserved, because that is the space between words and removing it is how a minifier visibly breaks a page. Runs of whitespace inside a block collapse to one, which is exactly what the browser already does.
What about my inline scripts and styles?
Both are minified too, with the same engines as the JavaScript and CSS pages here. If a script is broken the whole page fails to minify rather than silently dropping it.
Should I minify HTML at all?
It is the smallest win of the three. HTML compresses very well with gzip or brotli, which every server does, so minifying first usually saves a percent or two of what is already a small file. It is worth more for a page assembled at runtime, or one with a lot of inline CSS.
Does what I paste get sent anywhere?
No. Everything runs in your browser, on your own machine. Nothing is uploaded and nothing is logged. That matters more here than on most pages — source code, database queries and internal data are exactly the things that get pasted into tools like this, and most of them are a form that posts to a server.