HTML Minifier
Remove comments and spaces from HTML, inline CSS and JavaScript included.
Add HTML and click Minify to see the smaller code here.
How HTML Minifier works
Makes HTML smaller by removing comments, spaces and line breaks that a browser does not need. CSS in style tags and JavaScript in script tags can be minified too. After each run you see the size before and after, and how much smaller the file got.
Minifier also makes a few safe changes on its own. Boolean attributes get short form, like disabled instead of disabled="disabled". Type attributes on script, style and link tags are dropped, and the doctype becomes <!DOCTYPE html>.
Input to HTML Minifier
- Paste or type HTML into the input box, or upload a .html, .htm or .txt file.
- Remove comments: drops HTML comments.
- Collapse spaces: removes spaces and line breaks between tags and shortens runs of spaces in text.
- Minify inline CSS and Minify inline JavaScript: shrink the code inside style and script tags. All 4 options are on by default. Change one and the output updates right away.
- HTML with a broken tag, like a missing > or quote, shows an error with its line. Files up to 20MB. Everything runs in your browser.
Output from HTML Minifier
- Minified HTML, often on one line.
- Note above the editor with the size before and after, like 2.1 KB to 1.4 KB (33% smaller).
- Copy it, download it as a .html file or open it in full screen. Use HTML Formatter to make it readable again.