HTML Minifier

Minify HTML online with conservative whitespace handling. Preserve preformatted text and inline scripts, then copy compact markup.

The HTML Minifier shrinks markup for demos, email fragments, or transfer. It removes comments and unnecessary whitespace without intending to redesign your DOM.

Input
Output

When to use HTML Minifier

  • Preparing a compact HTML snippet
  • Removing leftover comments before sharing
  • Comparing size before vs after cleanup

Example

Input

<p>Hello <strong>world</strong></p>
<!-- note -->

Output

<p>Hello <strong>world</strong></p>

How to use

  1. Paste full HTML. Include comments and spacing you want reduced.
  2. Minify. Run to strip comments and collapse whitespace.
  3. Use compact output. Copy the smaller markup for paste targets that prefer compact HTML.

Processing and limitations

Uses conservative HTML whitespace collapse. Text in pre/textarea and inline scripts is preserved; inline CSS and JavaScript are not minified. Visible inline spacing can matter, so compare the rendered output before publishing.

Reference

Benefits

  • Free to use—no account required
  • Runs in your browser
  • Instant results with no software install
  • Basic processing does not upload your content to a server
  • Always keep a readable source copy. Minified HTML is harder to debug.

Not the same as

This is not a live preview. Use HTML Viewer or the compiler for rendering.

Related tools