FAQ
Is code inside script and style reformatted?
No. Both blocks are preserved verbatim so that line breaks and indentation inside JS or CSS are not damaged.
Are inline tags forced onto new lines?
No. Block-level tags break and indent while inline tags such as span and a stay on the same line, matching how they render.
Can minifying change how the page looks?
No. Whitespace between inline elements is kept (dropping it would glue a b into ab); only whitespace between block-level tags and comments is removed.
About this tool
Layout starts by classifying tags: block-level ones (div, p, ul, li, table, tr, td, headings) each take their own line and are indented by depth, while inline ones (span, a, b, em, code, img) stay on the current line. The output then matches how the browser actually lays the page out instead of exploding one sentence into eight lines.
The contents of script, style, pre and textarea are preserved character for character: newlines in JS, indentation in CSS and spaces inside <pre> are all significant, and reformatting them can change behaviour or appearance.
Whitespace has to be decided case by case, and this is where naive minifiers break pages: whitespace between inline elements is part of the layout — <span>x</span> <span>y</span> and the same tags glued together render differently. Minify therefore drops whitespace only next to block-level tags and keeps a single space between inline ones. Earlier versions removed all of it, turning a <b>b</b> c into abc — that changes rendering rather than size.
Tags are normalised: attributes are written as name="value", identical attribute pairs are deduplicated, boolean attributes (hidden, disabled) survive, and self-closing tags stay self-closing. It does not fix semantics: missing closing tags, invalid nesting and bad attribute values are simply laid out as written, with no error and no repair. Use a real validator for that.