HTML Minifier
Minify HTML: remove comments and collapse whitespace while preserving <pre>, <textarea> and <script> contents.
Runs in your browserHTML → HTML
Loading tool…
Example
<!-- header -->
<div class="box" id="main">
<p>
Hello <b>world</b> !
</p>
<pre> keep
this</pre>
</div><div class="box" id="main"><p>Hello <b>world</b> !</p><pre> keep
this</pre></div>How to use the HTML Minifier
- Paste or type your HTML into the input area, or open a file from your device.
- Adjust the options above the editor if the tool offers any.
- Review the HTML result, then copy it or download it as a file.
Privacy and limitations
- Your data is processed on your device and is not uploaded to any server.
- Inline <style> blocks are minified; inline <script> blocks are kept as written.
Related converters
CSS MinifierMinify CSS by stripping comments and whitespace and dropping redundant semicolons, without touching strings or URLs.JavaScript MinifierMinify JavaScript with Terser: remove whitespace and comments, shorten variable names and drop dead code.HTML BeautifierBeautify HTML with Prettier: consistent indentation plus formatting of embedded CSS and JavaScript.