HTML minifier
Remove ordinary HTML comments while preserving content and spacing
Remove ordinary HTML comments while preserving text-node whitespace and raw content inside script, style, pre, code and textarea blocks. This conservative approach protects visible spacing.
- No account needed
- Practical guide included
- Clear data boundaries
Preparing your workspace…
HTML minifier features and uses
This conservative minifier is useful for removing ordinary comments without rewriting the document’s content model or treating the input as safe HTML.
Use this on a copy of your markup and compare the rendered page afterward. This conservative tool removes supported comments; it does not promise the aggressive whitespace rewriting, JavaScript optimization or network compression provided by a build pipeline.
Continue this task with HTML to plain text and Meta tag inspector.
Common uses
- Clean exported HTML
- Remove development comments
- Prepare conservative static output
How to use this tool
Follow these steps to prepare your input, run the tool and review its output.
Keep a source copy
Paste your HTML source. Paste the exact version you intend to compare, including whitespace-sensitive sections.
Remove ordinary comments
Run the minifier. The operation deliberately preserves text-node whitespace and protected raw-content blocks.
Compare behavior before deployment
Copy or download the result and test the page. Check the output in the original page context, including inline elements and preformatted text.
Example input and output
Illustrative html minifier example
<!-- internal note --><p>Readable text</p>
<p>Readable text</p>
Demonstration only. The example shows ordinary comment removal, not aggressive markup rewriting.
How to interpret the results
Small savings are expected when most input bytes are real content rather than comments.
Minification is independent of sanitization, caching, image optimization and compression over the network.
Before you use the result
- Assuming the output has been sanitized.
- Expecting unused elements or scripts to be removed.
- Deploying without checking whitespace-sensitive content.
Frequently asked questions
Answers about using this tool, interpreting its results and how it handles your data.
How we handle your dataDoes this remove all unnecessary HTML whitespace?
No. The implementation favors preserving text spacing rather than aggressively collapsing the document.
Will script and preformatted content be rewritten?
Raw-content and preformatted blocks are preserved to avoid changing their meaning.
Can I use the output as trusted user HTML?
No. Comment removal does not make untrusted markup safe to insert into a page.
Why should I test the rendered result?
This conservative tool removes ordinary comments; it does not aggressively rewrite markup. Check the rendered page before deployment. It does not sanitize HTML or replace a build pipeline.
Is this tool free, and do I need to sign up?
This tool is free to use without an account or subscription. Supply your input in the workspace on this page, then run the tool. Your browser needs to support the features used by the tool; keep an original copy and review any generated output before applying it to a live website.
Are my files or text uploaded to your server?
This tool processes the supplied input locally in your browser. It does not upload your files or text to our server for processing. Copy or download the result you want to keep; the tool does not publish changes to your website automatically.