This minifier uses a conservative whitespace strategy. It compacts markup while keeping a single space where adjacent inline content may need one. Functional conditional, server-side include and Knockout comments remain intact. Your HTML never leaves your device.
Free HTML Minifier
Runs entirely in your browser - no upload, no sign-up.
What does an HTML minifier do?
An HTML minifier compresses markup by removing ordinary comments, indentation, line breaks and redundant spacing that browsers do not need. Paste a document or fragment to get compact HTML plus exact byte savings. Script, style, preformatted and textarea content stays unchanged, and all processing happens locally in your browser.
How to use
- 1Paste your HTML. Add a complete document or an HTML fragment to the input editor, or load the example.
- 2Choose comment handling. Keep comment removal on for the smallest result, or turn it off when review notes must remain.
- 3Review the savings. Check the original and minified UTF-8 byte sizes, percentage saved, lines removed and comments removed.
- 4Copy the result. Copy the compact HTML into your build output, CMS or local project. Keep your readable source for future editing.
Who it's for
- Frontend developers creating a smaller production copy of a static page, component demo or email template.
- Performance teams measuring how many uncompressed HTML bytes formatting and development comments add.
- CMS editors reducing exported page fragments before placing them in a template or content block.
- Students comparing readable source markup with the compact form browsers can parse.
FAQ
Is this HTML minifier free?
Yes. The HTML minifier is free to use without an account, download or usage quota. Paste your markup, review the live result and copy it directly from the browser.
Is my HTML uploaded anywhere?
No. Minification and byte measurement run locally in your browser. The HTML you paste is not sent to a server, so you can process unpublished templates, internal links and private page fragments on your own device.
How much HTML can I minify?
There is no server-side size limit because the tool does not upload your input. The practical limit depends on your browser memory and device, but ordinary pages, templates and email documents should update immediately.
Does the minifier change script or style content?
No. Content inside script and style elements is preserved byte for byte. The same protection applies to preformatted and textarea content, where spaces and line breaks may be meaningful. Use dedicated CSS or JavaScript minifiers when those embedded languages also need compression.
Which HTML comments are removed?
With comment removal enabled, ordinary development comments are removed. Functional Internet Explorer conditional comments, server-side include directives and Knockout binding comments stay in the output because deleting them could change behavior. You can also keep every comment by clearing the option.
Can HTML minification change how a page looks?
Aggressive whitespace removal can join words or alter whitespace-sensitive content. This tool takes a conservative approach: it collapses redundant whitespace, keeps possible inline separators and preserves raw or preformatted blocks. Always test the production page after any minification step.
Can I restore the original formatting later?
A formatter can add readable indentation to minified HTML, but it cannot recover removed comments or the exact original line breaks. Keep the readable source file in version control and treat the minified result as build output.