About this tool
Smaller HTML downloads faster. Content inside <pre> and <textarea> is left exactly as is, because whitespace there is visible.
Shrinking HTML without breaking the page
Minifying HTML removes comments, extra spaces and line breaks that browsers do not need. The page looks and works the same, but the file is smaller, so it downloads a little faster, especially on slow mobile connections. For high-traffic pages, those savings add up across every visit. Minification is a standard step in many build processes, and this tool lets you do it by hand for a single page or template.
Some content must be left exactly as it is, and the minifier respects that. Text inside pre and textarea elements keeps its spacing, because whitespace there is visible to users. Inline script and style blocks are preserved so that your code continues to run. Comments are removed, except for special conditional comments that older systems sometimes rely on.
Test the result before using it in production. In rare cases, removing whitespace between inline elements, such as buttons or links placed side by side, can change the gap between them slightly. If that happens, adjust the spacing with CSS rather than relying on spaces in the HTML. Keep the original, readable file in your project and minify only the copy you publish, because editing minified HTML by hand is difficult. For the biggest gains, combine minification with server compression such as gzip or Brotli, and minify your CSS and JavaScript as well. Everything runs in your browser, so unpublished pages and templates stay on your own computer. Running a quick check with your browser's developer tools after publishing confirms that the smaller file is being served as expected, and that nothing visible has shifted on the page.
How to use it
- Paste your text into the input box, or open a file from your device.
- Adjust the options. The result updates instantly.
- Copy the result, or download it as a file where offered.
Questions
Is it safe for inline scripts?
Script and style contents are left untouched, so this tool will not break them. Use a dedicated JavaScript minifier for those.
Are conditional comments kept?
Comments starting with <!--[if are kept; all other comments are removed.
Last reviewed 16 October 2026.
