Paste minified or messy HTML and get properly indented markup back, with the nesting visible at a glance. The tricky parts are handled rather than ignored: inline elements stay inline, so a paragraph containing a link or some bold text remains one readable line instead of being exploded across four; an element that holds only text keeps its closing tag on the same line; and the contents of pre, textarea, script and style are preserved exactly, because whitespace in those is significant and collapsing it changes what the page renders. Spaces around inline tags are carried through explicitly too — losing them runs words together, which is a formatter silently editing your content rather than its layout. Void elements are left unclosed. It runs entirely in your browser.
| Element | Treatment |
|---|---|
| div, section, ul, li | Own line, contents indented |
| p with only text | Stays on one line, closing tag included |
| a, span, strong, em | Inline — no forced break, spaces preserved |
| img, br, input, meta | Own line, never given a closing tag |
| pre, textarea | Contents preserved exactly |
| script, style | Contents preserved, not reindented |
| <!-- comment --> | Own line |
It should not. Inline spacing is preserved, and pre, textarea, script and style bodies are left byte-for-byte. Those are the three places where reformatting HTML can genuinely alter output, and each is handled deliberately.
Because they are inline elements, or because the element contains only text. Breaking a paragraph with a link inside it across four lines makes it less readable, not more, and in some contexts adds rendered whitespace that was not there before.
Their contents are preserved exactly as written and not reindented. Formatting JavaScript or CSS correctly is a different job — use the dedicated JS or CSS formatter for those.
No. Elements such as img, br, input and meta have no closing tag in HTML, and adding a self-closing slash is unnecessary. They are emitted exactly as given, each on its own line.
They share the same engine. This page is focused on making markup readable; the minifier focuses on making it small, with compression levels, batch file handling and analysis alongside.
No. Formatting happens in your browser. Unpublished pages and markup containing customer data are never sent to a server, logged, or stored.
Before any whitespace is touched, the bodies of pre, textarea, script and style are stashed and replaced with placeholders, because whitespace inside them is significant — collapsing it changes what the page renders or what the script does. The remaining markup is normalised and then walked tag by tag, tracking nesting depth. Three distinctions do the real work. Void elements are never given a closing tag. Inline elements do not force a line break, so a paragraph containing bold text stays on one line rather than being exploded across four. And a closing tag only goes on its own line when the element actually contained block-level children — an element holding just text keeps its closing tag inline, which is the difference between correct output and a paragraph that reads as an opening tag, text, then a stray closing tag on the next line. Spaces that separated text from an adjacent inline element are carried through explicitly, since dropping them runs words together and visibly changes the rendered page. The same engine backs the Beautify tab of the HTML Minifier.