HTML Minifier
Minify HTML to reduce file size. Collapses whitespace, removes comments, safe defaults.
MinifyCompressClient-sideUnlimited
0 / 500,000
How to use
- Paste your HTML. Formatted HTML works fine.
- Copy the minified output. Smaller payload, same markup.
Common use cases
- Shrinking email templates
- Reducing initial HTML payload for SSR pages
- Preparing static HTML for CDN delivery
- Inlining HTML strings into JavaScript or JSON literals
Frequently asked questions
- How much does HTML minification typically save?
- Real-world savings range from 10% to 40% off the original size, depending on how much whitespace and how many comments the source HTML has. Email templates and CMS-generated HTML usually compress more than hand-written markup.
- Will minification break my markup?
- No. The minifier uses safe defaults from html-minifier-terser: collapse whitespace where it does not affect rendering, remove HTML comments, and trim insignificant attribute whitespace. Whitespace inside <pre>, <textarea>, <script>, and <style> is preserved.
- Are HTML comments removed?
- Yes, including <!-- comments --> blocks. Conditional comments for old IE (e.g. <!--[if IE]>) are preserved if your target audience needs them; otherwise they will also be stripped on aggressive settings.
- Will it minify inline CSS and JavaScript inside my HTML?
- No. Only HTML-level whitespace and comments are touched. Use the dedicated CSS Minifier or a JS minifier (Terser, esbuild) if you also want to compress inline assets.
- Does minification happen in the browser?
- Yes. The html-minifier-terser library runs locally; HTML never leaves your machine.
Related tools
How to use
- Paste your HTML. Formatted HTML works fine.
- Copy the minified output. Smaller payload, same markup.
Common use cases
- Shrinking email templates
- Reducing initial HTML payload for SSR pages
- Preparing static HTML for CDN delivery
- Inlining HTML strings into JavaScript or JSON literals
Frequently asked questions
- How much does HTML minification typically save?
- Real-world savings range from 10% to 40% off the original size, depending on how much whitespace and how many comments the source HTML has. Email templates and CMS-generated HTML usually compress more than hand-written markup.
- Will minification break my markup?
- No. The minifier uses safe defaults from html-minifier-terser: collapse whitespace where it does not affect rendering, remove HTML comments, and trim insignificant attribute whitespace. Whitespace inside <pre>, <textarea>, <script>, and <style> is preserved.
- Are HTML comments removed?
- Yes, including <!-- comments --> blocks. Conditional comments for old IE (e.g. <!--[if IE]>) are preserved if your target audience needs them; otherwise they will also be stripped on aggressive settings.
- Will it minify inline CSS and JavaScript inside my HTML?
- No. Only HTML-level whitespace and comments are touched. Use the dedicated CSS Minifier or a JS minifier (Terser, esbuild) if you also want to compress inline assets.
- Does minification happen in the browser?
- Yes. The html-minifier-terser library runs locally; HTML never leaves your machine.