Minify your HTML by stripping comments and collapsing unnecessary whitespace, while protecting script, style and pre content.
Google AdSense Banner
This area will contain advertisements after approval.
Google AdSense Banner
This area will contain advertisements after approval.
This tool strips HTML comments (except conditional comments), then collapses whitespace between and within tags down to a minimum. The contents of <script>, <style>, <pre> and <textarea> tags are protected from whitespace collapsing first, since removing newlines there could break JavaScript comments, CSS, or visibly alter preformatted text.
This is a regex/heuristic-based minifier, not a full HTML parser, so it won't rename attributes, remove optional quotes, or perform the more aggressive optimizations a build-tool-grade minifier would. It focuses on the safe, high-impact wins: comments and whitespace, which typically account for most of the reducible size in hand-written HTML.
Minifying '<div>\n <p>Hello</p>\n</div>' (a div containing a paragraph, spread across three lines with indentation) collapses down to '<div><p>Hello</p></div>' on a single line, the newlines and indentation between tags are removed entirely since they have no visual effect in rendered HTML.
Expecting this to rewrite attributes or remove optional quotes the way a build-tool-grade minifier (like html-minifier-terser) would, this tool focuses specifically on comments and whitespace, the two safest, highest-impact wins for hand-written HTML.
Worrying that minifying will break a <pre> block's meaningful whitespace, content inside <pre>, <script>, <style> and <textarea> is explicitly protected and passed through untouched.
Running minified output back through a diff tool and being surprised by 'everything changed', since whitespace and line breaks are removed, a line-based diff against the original will show the whole file as different even though the rendered result is identical.
No, content inside <script>, <style>, <pre> and <textarea> tags is left completely untouched, only whitespace outside those tags is collapsed.
No, all minification happens entirely in your browser, your code is never transmitted anywhere.
Google AdSense Banner
This area will contain advertisements after approval.