HTML Minifier & Beautifier

Compress HTML or re-indent it for reading — with whitespace that actually affects rendering left alone rather than silently collapsed.

Only whitespace and comments are ever changed. No HTML token is renamed, reordered or removed, so the output cannot behave differently from your input. That also means the size reduction is smaller than tools which rewrite your code .

Indent
Off by default: conditional comments and build markers look like ordinary comments, so removing them is your call. Note SQL comments can carry real meaning (query hints in some databases live in comments), so check before stripping. A /*! banner comment is always kept, the usual convention for a licence header.

Drop a HTML file here

or or paste below

Up to 4 MB · nothing uploaded

{{ inBytes }}
{{ outBytes }}
{{ status }}

{{ commentWarning }}

Your HTML is tokenized and reformatted entirely in your browser. Nothing you paste or drop is ever uploaded to a server.

Whitespace in HTML is not always decoration

Between two block-level tags it is pure layout and can go. Next to an inline element it is rendered as a space: delete the gap in <span>a</span> <span>b</span> and the two words run together. This tool collapses that kind of whitespace to a single space rather than removing it, which is the difference between a smaller page and a visibly broken one.

pre, textarea, script and style are left exactly alone

Whitespace inside <pre> and <textarea> is significant by definition — reformatting it changes what the user sees. <script> and <style> contents are different languages entirely. All four are captured verbatim and never reflowed.

Comments are kept unless you say otherwise

Legacy conditional comments, framework hydration markers and build-tool placeholders all look like ordinary comments and all do something. Rather than delete them silently, this tool counts them and tells you, leaving the decision with you.

Beautifying only adds line breaks where they are safe

A newline is introduced where whitespace already existed, or between two block-level tags — never between two inline elements that were touching, because that would add a rendered space that was not in your input.

Will minifying HTML change how my page looks?

Not if the tool is careful, which is the point of the restrictions here. Whitespace between two block-level tags is layout only and is removed. Whitespace next to an inline element or text is rendered as a space, so it is collapsed to a single space and never removed entirely.

What happens to pre, textarea and script content?

It is left exactly as written. Whitespace inside pre and textarea is significant by definition, and script and style contents are different languages, so the HTML pass treats all of them as opaque and never reflows them.

Why are comments kept by default?

Because some are load-bearing: legacy conditional comments and framework or build markers all look like ordinary comments. The tool reports how many it found and lets you remove them deliberately, rather than deleting them silently.

Can it beautify minified HTML?

Yes. It re-indents by nesting depth, but only introduces a line break where whitespace already existed or between two block-level tags — inserting one between two touching inline elements would add a rendered space that was not in your input.

Is my HTML uploaded anywhere?

No. Everything runs in your browser. Nothing is transmitted to a server.