Skip to content
LovelyTools
EN

HTML Minifier

Shrink HTML by removing comments and collapsing whitespace safely.

Processed locally on your device — nothing is uploaded.

About the HTML Minifier

Every byte of HTML has to be downloaded before a page can render. The HTML minifier strips comments and collapses the indentation and line breaks that only exist for human readers.

It is deliberately conservative: content inside <pre>, <textarea>, <script> and <style> is never touched, and conditional comments are kept, so the page renders the same as before.

How to use the HTML Minifier

  1. Paste your HTML.
  2. Choose whether to remove comments and collapse whitespace.
  3. Press Convert and copy the minified output.

Features

  • Removes comments (keeps conditional comments)
  • Collapses whitespace
  • Protects pre, textarea, script and style
  • Shows size savings

Supported formats

  • HTML
  • .html
  • .htm

Frequently asked questions

Is my code uploaded?

No. Formatting and minifying run in your browser, so proprietary code and secrets never leave your device.

Should I minify if my server uses gzip?

Gzip already removes much of the redundancy, but minifying still reduces the size a little and speeds up parsing.