HTML Minifier
Strips HTML comments and collapses whitespace between tags. Content inside <script>, <style>, <pre> and <textarea> is left exactly as-is, since whitespace there can be meaningful.
What this does and doesn't do
This is a safe, conservative minifier — it removes comments and extra whitespace but never touches the content of scripts, styles, or preformatted text. It won't shrink your file as aggressively as a full build-tool minifier (like html-minifier-terser used in Webpack/Vite pipelines), but it also won't risk breaking your page. Always preview the result before deploying it.
How to use the HTML Minifier
- Paste your HTML.
- Copy the minified result from the output box.
- Test the page once before publishing.
Frequently asked questions
Is minifying HTML worth it?
The gain is modest if your host already compresses files with gzip or Brotli, but it still trims bytes on large pages.
Will it break my inline scripts?
No. Content inside <script>, <style>, <pre> and <textarea> is left exactly as written.
Are conditional comments kept?
Ordinary comments are removed. Keep a copy of your original file for editing later.