HTML Minifier
Strip comments and redundant whitespace from HTML to cut page weight, keeping one meaningful space between inline elements and preformatted text.
How to use
- Paste HTML into the input.
- Turn on keeping comments only if you need them in production.
- Copy the single-line output.
An HTML minifier removes the whitespace and comments a browser does not need, which lowers the size you send over the wire. Content inside pre and textarea is left alone because it is significant there.
Paste or type something above.
Questions about html minifier
- Does it remove comments?
- Yes, unless you turn on keeping comments. Conditional comments and licence headers are worth keeping for production builds.
- Will it break inline layout?
- A single space is preserved between inline elements so words do not run together, while indentation whitespace is removed.
- Does it minify inline CSS and JavaScript?
- No. That needs a build step or a dedicated asset minifier, because both have rules a text pass cannot guess.
Related tools
- HTML Formatter Re-indent HTML with consistent indentation and one tag per line, while keeping script, sty...
- CSS Minifier Remove comments and redundant whitespace from CSS to shrink the file, keeping strings and...
- JavaScript Minifier Strip comments and unneeded whitespace from JavaScript to cut file size, while keeping str...