Data

HTML Minifier & Compressor

Minify HTML locally by removing regular comments and collapsing whitespace while preserving sensitive raw-text blocks and important comments.

Browser-local
Local workspaceInput never leaves this tab
Preserves pre, textarea, script, style, conditional comments, and license comments
0
Minified HTMLReady

HTML is transformed entirely in this browser tab. Content inside pre, textarea, script, and style elements remains untouched, and no source is uploaded.

About this tool

What HTML Minifier does

HTML minification reduces transfer size by removing comments and unnecessary whitespace. The safe mode preserves visible spacing between inline elements, while the optional aggressive mode removes inter-tag whitespace for templates where that behavior has been reviewed.

Common uses

  • Compress generated HTML before embedding or transfer
  • Remove development comments from an HTML fragment
  • Compare safe and aggressive whitespace strategies

Privacy and limitations

HTML is transformed entirely in this browser tab. Content inside pre, textarea, script, and style elements remains untouched, and no source is uploaded.

Validate important output in the actual language, database, or target platform.

Frequently asked questions

Can minification change page rendering?

Safe mode keeps one whitespace character in text regions. Aggressive mode can remove meaningful spacing between inline elements, so preview and test its output before deployment.

Are scripts and styles minified?

No. Their complete blocks are preserved to avoid corrupting JavaScript, CSS, templates, or embedded data. Use language-aware tools for those assets.

Which comments are kept?

Conditional comments plus comments marked as license, preserve, copyright, or beginning with an exclamation mark are retained.