>
PERMARKET
ToolsDeveloperHTML Minifier
MIN

HTML Minifier

Strip comments and extra whitespace from HTML.

Minified HTML appears here…
Ad · Large Rectangle (336×280)

How to use HTML Minifier

Remove HTML comments and collapse whitespace between tags to shrink markup.

  1. Open HTML Minifier on toolpermarket — the form is ready, so type your numbers and read the result.

  2. In the HTML field, paste the HTML markup you want to shrink. Comments are removed entirely, including conditional ones.

  3. Press Minify to compute the result. The output appears immediately below the form. Edit a value and press the button once more to see the updated answer.

  4. Read the result and use it as needed. If the number looks off, re-check your inputs and run it again — the math is deterministic, so the same entries always return the same answer.

Worked example. Paste "<!-- note --><div>\n <p>Hello</p>\n</div>" and get "<div><p>Hello</p></div>" with no comments or surplus whitespace.

Tips for accurate results.

  • HTML comments are stripped completely.

  • Whitespace between tags is collapsed to nothing.

  • Inside <pre> or <textarea> the tool does not touch your spacing.

When to use HTML Minifier. Shrinking a snippet before embedding it. Cleaning pasted markup for a docs page. Comparing two versions of the same HTML.

When you actually reach for this

  • You want to trim a page's HTML before deploying so users download fewer bytes on first load.
  • You are building a static site and need to strip comments and optional tags from the output.

Where this tool stops being accurate

  • Removing optional tags (like </li>) is safe only if the browser parses the same way; some aggressive options can change whitespace-sensitive content such as <pre> or inline JS.
  • Minifying HTML that contains inline scripts/styles can mangle them if the tool does not respect those contexts.

Frequently asked questions

Does minifying change what the page shows?

No. Removing comments and collapsing inter-tag whitespace does not alter the rendered DOM, so the visible result is identical.

Will it break my <pre> blocks?

The tool collapses whitespace only between tags, not inside them, so text in a <pre> block you intend to keep verbatim should be minified with care or kept outside the tool.

Are scripts and styles touched?

Inline script and style content is left as-is; only the surrounding HTML whitespace and comments are reduced.

Will minifying HTML break my inline JavaScript?

It can, if the minifier touches content inside <script> or mis-handles < in comparisons. Use a tool that treats script and style bodies as opaque.

Should I minify HTML or just gzip it?

Both help: minification removes bytes permanently (and helps caching), gzip compresses what remains. Minify at build time, gzip at serve time.