Toolstia / HTML minifier
HTML minifier
Paste your HTML and get a smaller version with comments, extra spaces and line breaks removed. The tool shows the size before and after.
Extra spaces, line breaks and comments are removed. Text inside pre, textarea, script and style tags is left exactly as it is, and single spaces between inline elements are kept so the page looks the same. To shrink the CSS or JavaScript inside, use the CSS and JavaScript minifiers.
How it works
- Paste your HTML.
- Choose whether to remove comments.
- Copy the minified HTML.
What is removed
HTML comments, runs of spaces and line breaks, and the spaces around block elements such as div, p and li.
What is kept
Text inside pre, textarea, script and style tags stays exactly as it is, and single spaces between inline elements are kept, so the page looks the same.
Conditional comments
Old Internet Explorer conditional comments are kept even when you remove other comments.
Other files
To shrink the CSS or JavaScript inside your page, use the CSS and JavaScript minifiers.
Questions
Will it break my page?
The rules are cautious, but always test the minified page. Keep the original file as a backup.
How much will I save?
Often 10 to 30 percent for hand-written HTML. Gzip compression on your server saves more.
Is my HTML uploaded?
Everything happens in your browser, and nothing you enter is sent anywhere.