HTML Minifier
Strip comments and collapse whitespace in HTML. Keeps <pre>, <textarea>, <script> and <style> safe.
Quick answer: Strip comments and collapse whitespace in HTML. Keeps <pre>, <textarea>, <script> and <style> safe.
Last updated
Frequently asked questions
- How do I minify HTML?
- Paste your HTML and the minified version appears immediately. The byte counter shows how much you saved.
- Will it break my page?
- It preserves <pre>, <textarea>, <script> and <style> contents verbatim, so layout-sensitive whitespace inside them is safe.
- Are HTML comments removed?
- Yes — except IE conditional comments (`<!--[if …]>`). If you rely on a comment for tooling, leave the file un-minified.
- How much smaller does HTML get?
- Typically 10–30% — bigger savings on heavily-indented templates. The exact number is shown under the output.
- Should I minify HTML in production?
- If you serve a lot of HTML and don't already have gzip + a build-step minifier, yes. If your CDN already gzips, the marginal gain is small.
- Is the HTML sent to a server?
- No. Minifying runs entirely in your browser.
- Why is my output identical to my input?
- If your HTML is already minified or has no comments / extra whitespace, there's nothing to remove.
- Can I un-minify HTML?
- There's no perfect inverse — pretty-printers add a layout that may or may not match what you wrote. Most editors include 'format document' for that.
- Can I minify huge HTML files?
- Yes — the practical limit is your device's memory. Hundreds of KB minify instantly.
- Is this HTML minifier free?
- Yes — free, no signup, no limits.