How to use the HTML Minifier
- 1Paste your HTML.
- 2Click Minify.
- 3Copy or download the minified output.
About the HTML Minifier
Minified HTML downloads and parses faster. This tool removes comments and collapses whitespace while preserving <pre>, <textarea>, <script> and <style> content.
Paste markup, minify and copy or download the result.
When to use the HTML Minifier
Preparing a static landing page
Before publishing a hand-built landing page, reduce the extra spacing and ordinary comments left in its HTML source. Paste the finished markup, choose whether to remove comments and collapse whitespace, then compare the displayed byte sizes. Keep your readable original separately so future edits do not depend on the compressed copy.
Reducing exported template markup size
A template export can contain indentation and comments that are useful during development but unnecessary in the delivered document. Minify a copy before adding it to your publishing workflow. Review inline text spacing in a browser afterward, because removing whitespace between tags can affect the visible separation between neighboring inline elements.
Comparing HTML cleanup settings separately
When you need to understand which cleanup changes suit an existing page, test the two switches independently. Start by removing comments without collapsing whitespace, then try whitespace cleanup on another copy. The output and savings figures help you compare results while checking whether template annotations or visible text spacing need special treatment.
Tips and best practices
- Keep the unminified document as your editing source. Download the compressed result as index.min.html only after reviewing it against the original page.
- Turn off Remove comments when your publishing system depends on HTML comment markers. Ordinary comments are removed by default, so inspect template instructions before processing.
- Preview links, buttons, and adjacent inline elements after collapsing whitespace. A space between tags can be meaningful even when the surrounding markup looks redundant.
- Embedded style blocks receive CSS minification, while script contents are preserved. Use the JavaScript minifier separately if you also need to reduce embedded script code.