HTML Minifier

Conservatively compact HTML tag syntax while retaining text whitespace and comments. Runs entirely in your browser.

Why Minify HTML? — Reduce File Size and Improve Core Web Vitals

This tool performs conservative HTML tag-whitespace compaction. It does not remove text-node whitespace, comments, or optional tags. Rendering and performance should be verified in your target browser.

What This Tool Preserves

How Much Does HTML Minification Save?

Savings may be small or zero because text whitespace and comments are preserved. This is not a full HTML parser or a replacement for a tested production minifier. Measure actual transfer sizes with your server compression enabled.

HTML Minification Best Practices

Frequently Asked Questions

Script and style blocks, quoted attributes, and comments are retained rather than minified. This lightweight tokenizer is not a full HTML parser; test output, especially malformed markup or unusual embedding contexts.
The tool preserves text-node whitespace, including spaces between inline elements and preformatted content. It only compacts whitespace in recognized tag syntax; verify rendering before production use.
SVG text and quoted attributes are retained. The tool does not perform SVG-specific optimization or validation, so review the result in a browser.
Input processing is local to this tool. Shared page features may make network requests, and enabled browser drafts may retain text locally. Avoid pasting credentials or confidential material.
Source compaction and gzip/Brotli can be combined. This conservative tool may make little difference after compression; measure the actual benefit rather than expecting a fixed reduction or faster page load.