HTML Minifier
Minify HTML in your browser. Remove comments, reduce whitespace, optionally minify inline CSS and JavaScript, and review the size savings.
What is HTML Minifier?
Make HTML smaller by removing comments and reducing whitespace. You can also minify inline CSS and JavaScript. Compare the size and review the diff before using the output.
How to use
- 1
Paste your HTML and choose which minification options to apply.
- 2
Click Minify HTML. Compare the original and minified sizes, then open Show Diff to review the changes.
- 3
Copy the result or click Download. Test the minified page before publishing it.
Common Use Cases
- 1
Compress email template HTML before embedding it in a CMS or email service provider
- 2
Minify HTML component markup to reduce initial page load size in production builds
- 3
Strip HTML comments from generated code before including it in a public-facing page
- 4
Reduce the size of static HTML files served from a CDN to improve page load time
- 5
Clean up auto-generated HTML from word processors before using it in a web project
Try an Example
Example Input
<section> <h2>Pricing</h2> <!-- temporary --> <p>Simple plans for every team.</p> </section>
Expected Output
<section> <h2>Pricing</h2> <p>Simple plans for every team.</p> </section>
Frequently Asked Questions
Does this minify external CSS or JavaScript files?
No. The inline options apply to CSS and JavaScript inside the supplied HTML. The tool does not fetch or bundle linked files.
Should I test the minified HTML before publishing?
Yes. Review the diff and test the result in your project, especially if spacing or inline code affects how the page works.