Skip to content

Free HTML Minifier Online

Paste or upload your HTML and compress it instantly in your browser. Removes comments, whitespace, and redundant markup — inline CSS and JS minified too.

Detected language:HTML
Loading editor...
Use this editor to input your HTML, CSS, or JavaScript code. The language is automatically detected. You can minify code to reduce file size or beautify it to improve readability. Files can also be uploaded by dragging and dropping them onto this editor. Keyboard shortcuts: Ctrl+Shift+M to minify, Ctrl+Shift+B to beautify, Ctrl+S to download.

What gets minified

HTML minification targets the characters browsers skip anyway: whitespace between tags, comments, and blank lines. Most of the savings come from indented templates and CMS-generated markup, which tends to be heavily padded with whitespace that has no effect on rendering.

Inline <style> and <script> blocks are minified using full CSS and JavaScript rules — not just stripped of whitespace. Pre-formatted blocks (<pre>, <textarea>) are left untouched.

Useful for one-off files, checking minification output before committing to a build tool, or compressing HTML from a third-party source. Nothing is uploaded — your browser does all the work.

HTML Minifier FAQ

What does the HTML minifier remove?

It removes HTML comments, unnecessary whitespace between tags, redundant newlines, and leading/trailing spaces. Inline <style> and <script> blocks are also minified using CSS and JavaScript rules.

Will minifying HTML break my page layout?

No. Whitespace between block-level elements has no visual effect. Inline elements like <span> can occasionally be affected if you rely on whitespace between them, so review the output if your layout uses inline text nodes.

How much can HTML minification save?

Typical savings range from 15–30%. Pages with lots of comments or indented templates see larger reductions. Combined with gzip/Brotli compression on your server, HTML size can be reduced by 80%+ total.

Should I use a build tool for HTML minification instead?

For automated pipelines, yes — tools like html-minifier-terser integrate directly into Webpack, Vite, and Gulp. MinifyTools is useful for one-off files, previewing minification output before committing to a build setup, or compressing HTML you can't run through a build pipeline.

Other minifiers