Skip to content

HTML Minifier

Minify HTML: remove comments and collapse whitespace while preserving <pre>, <textarea> and <script> contents.

Runs in your browserHTML → HTML
Loading tool…

Example

Input
<!-- header -->
<div class="box"  id="main">
  <p>
    Hello   <b>world</b> !
  </p>
  <pre>  keep
    this</pre>
</div>
Output
<div class="box" id="main"><p>Hello <b>world</b> !</p><pre>  keep
    this</pre></div>

How to use the HTML Minifier

  1. Paste or type your HTML into the input area, or open a file from your device.
  2. Adjust the options above the editor if the tool offers any.
  3. 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.

Browse all minifiers →