What this tool does
Minified or badly indented HTML becomes readable HTML.
<ul><li>a</li><li>b</li></ul>
<ul>
<li>a</li>
<li>b</li>
</ul>
One indentation level per nesting level, two spaces by default and four if you prefer. Tag names, attributes and their order are untouched: this is a layout pass, not a rewrite.
A line break is not free
<p>Hello <b>world</b> again</p>
That stays on one line. In HTML, whitespace between inline elements is part of the text: break the line between </b> and again and you have added a space — visible in the rendering, in a selection, in a copy-paste. The formatter therefore indents around block elements (div, p, ul, table…) and leaves runs of inline content alone, however long they get.
It is the same rule the HTML minifier applies in the other direction, and for the same reason: nothing that changes the rendered page counts as formatting.
What it never touches
<pre>and<textarea>. Their whitespace is displayed exactly as written — reindenting them would rewrite the page and the form value.<script>and<style>. Their content is JavaScript and CSS, not HTML; the JavaScript and CSS formatters on this site are the tools for those.- Your attributes. Names, values, quotes and order come out as they went in, spaces inside a value included.
It is not a validator
<div><p>x</div>
<div>
<p>x
</div>
The unclosed <p> comes back unclosed. A formatter reads the document you give it and lays it out; guessing where a tag was meant to close would be rewriting your markup on a hunch. To know whether a document is well-formed, use a validator — the W3C one, or your browser’s dev tools, which show you the tree the parser actually built.
Private by design
Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.