Developer utility

HTML Minifier

Compress HTML while protecting whitespace-sensitive content, compare source and output sizes, inspect warnings, and preview both versions locally before deployment.

Input

Paste HTML

Minification options

Ready to process HTML.

Size reduction0.0%

Paste HTML to calculate output size and savings.

Original0 B
Output0 B
Saved0 B
Comments removed0

Output

Minified or beautified HTML

0 characters · 0 HTML tokens

Safety checks

HTML structure and optimization notes

Paste HTML to calculate output size and savings.

Isolated comparison

Source and output previews

Source

Output

Both previews run without script permission. A restrictive preview-only CSP also blocks network requests without changing the generated output.

Examples

HTML minification samples

HTML minification option reference

OptionDefaultEffectRisk
Remove commentsOnRemoves ordinary HTML comments while retaining selected special comments.Low when conditional and license comments are preserved.
Simplify attributesOnRemoves redundant script/style MIME types and safely collapses boolean attributes.Low for modern HTML; quoted attribute values are parsed without global regex replacement.
Minify inline CSSOnCompresses style blocks and style attributes while retaining /*! license */ comments.Review legacy CSS hacks and compare complex declarations.
Remove empty class/idOffRemoves empty class and id attributes only.May affect scripts that inspect attribute presence.
Remove all inter-tag whitespaceOffChanges adjacent closing and opening tags to have no separating whitespace.Can join inline content and change layout; visually test before use.

HTML Minifier FAQ

Does this HTML minifier upload my code?

No. Tokenization, compression, formatting, statistics, previews, copying, and downloads run locally in the browser.

Why does conservative mode keep space between tags?

Whitespace between inline elements can be visible. Keeping one space is safer than always joining adjacent closing and opening tags.

Which contents are protected?

Pre, textarea, code, script, style, template, SVG, and MathML blocks keep their internal whitespace. Style blocks and style attributes are only compressed when that option is enabled.

Should I use this instead of a build-pipeline minifier?

It is useful for snippets, inspection, and one-off files. Production builds should use a tested project-level minifier and retain source files and version control.