CODING & JSON · BFOTKIT

HTML Minifier | BFOTKit

Remove comments and collapse whitespace between tags to cut HTML size, with options to keep conditional comments and control how aggressively whitespace is squeezed.

Output

All processing happens in this browser tab. Nothing is sent to a server.

GUIDE

How to minify HTML

What gets removed

The minifier strips comments (optionally keeping old conditional comments), removes line breaks and indentation between tags, and collapses runs of whitespace into single spaces. Bytes saved matter most on templates served on every page load.

Whitespace between inline elements

Collapsing the whitespace between tags removes the spaces that render between inline elements such as emphasized words or inline images. If your layout depends on those visible spaces, turn the collapse option off or add your own explicit spacing in CSS.

Script and style bodies are preserved

Contents of script, style, and pre elements are not touched: collapsing whitespace inside them would break code and preformatted text. Minify those blocks with their own dedicated tools instead.

Verify after minifying

Minify, download, and open the result in a browser next to the original. If a page depends on whitespace-sensitive inline spacing, compare carefully. Keep the readable original as your working copy and minify at build or deploy time.

HELP / FAQ

HTML minifier questions

How much smaller will my HTML get?

Typical hand-written templates shrink by 10 to 30 percent, mostly from indentation and comments. Machine-generated markup with long attribute lists saves less; heavily commented templates save more.

Does it remove conditional comments?

Only if you allow it. The keep-conditional option preserves comments like if-lte IE 9 that some legacy pages still rely on, and strips all others.

Is it safe for inline SVG?

Yes. SVG elements are tags like any other; the minifier only removes whitespace between tags, never attribute values, so path data inside attributes stays intact.

Can I minify every build automatically?

This tool is manual and private, good for one-off files. For pipelines, run minification at build time with your own tooling; the rules used here are deliberately conservative for the same reasons.

EXPLORE BY CATEGORY · BFOTKIT

More tools like this

Pick a category to see every tool in it — then open one and discover related tools.

Browse all tools