100% Free · No Signup · No Ads

HTML Minifier

Minify HTML with safe presets, a live before/after rendered preview, a real gzip-compressed size estimate, and inline CSS/JS cleanup.

Minified output



  

Everything in one tool

👁️

Live rendered preview

See the before and after render side by side (well, tab by tab) to confirm minification didn't visually break anything.

📦

Real gzip size estimate

Get an actual gzip-compressed size estimate using your browser's native compression engine, not just a raw byte count.

🎚️

Safe presets, not a checkbox wall

Start with a sensible Safe preset or go Aggressive — no need to research every option before you get a usable result.

🌳

Parser-based, not regex

HTML is parsed into a real DOM tree and reserialized, so whitespace-sensitive tags like <pre> and <textarea> are never corrupted.

🎨

Inline CSS & JS cleanup

Minifies CSS inside <style> tags and style attributes, plus safe whitespace-only cleanup for inline <script> blocks.

🔒

100% client-side & private

Everything runs in your browser. Your HTML is never uploaded or stored.

How this compares

The classic HTMLMinifier tool is powerful but text-only, with dozens of raw checkboxes and no way to confirm the result still looks right.

FeatureSEOTriggerskangax.github.ioCodeBeautify.org
Whitespace, comments & redundant attribute removal
Safe / Aggressive presets (not a raw checkbox wall)Minimal options
Live before/after rendered preview
Real gzip-compressed size estimate
Fetch directly from a live URL
No adsAd-heavy

Need to check your page's meta tags too? Try the Meta Tag Generator.

What gets minified — and what's intentionally left alone

TransformationWhy it's safe
Whitespace collapsingRuns of spaces/tabs/newlines are collapsed to a single space, never fully removed, so inline spacing between words is preserved. Content inside <pre>, <textarea>, <script> and <style> is left exactly as-is.
Comment removalOrdinary HTML comments are stripped; conditional comments can be preserved with a dedicated option.
Redundant attributesOnly default values like type="text/javascript" on <script> are removed — attributes with non-default values are always kept.
Optional closing tagsIntentionally NOT removed. Modeling HTML5's tag-omission rules correctly is complex, and getting it wrong can break page structure — not worth the risk for a small byte saving.

Frequently asked questions

Yes, though the gains are smaller than on an uncompressed transfer. Gzip compresses repetitive whitespace and text very efficiently, so minification mostly helps by reducing parse time and DOM construction work in the browser, plus it still shaves some bytes off even after compression, particularly from comments and redundant attributes.

It can if the minifier is too aggressive — for example, collapsing whitespace inside a <pre> block or incorrectly altering inline JavaScript. This tool only applies transformations that are safe by the HTML5 spec, preserves whitespace-sensitive tags like <pre> and <textarea> exactly, and only does safe whitespace-only cleanup on inline JavaScript rather than full logic rewriting.

For a one-off page or a quick check, minifying manually with a tool like this is fine. For a full site, it's better to automate minification as part of your build or deployment pipeline so every page is minified consistently without needing a manual step each time.

While the HTML5 spec does allow omitting certain closing tags, doing so reliably requires modeling the full HTML5 tag-omission rules, and getting an edge case wrong can silently break page structure. This tool intentionally skips that transformation to keep every output guaranteed valid and safe to ship.

It depends heavily on how much whitespace, comments, and redundant attributes are in the source. Hand-written or template-generated HTML often shrinks by 10 to 30 percent before compression, while HTML that's already compact from a build tool may only shrink by a few percent.