Why format HTML?
Formatting does not change what a page does — browsers ignore the whitespace between tags — but it changes how quickly a human can read it. Minified HTML, a page saved from a CMS, or code pasted out of a chat window often arrives as one enormous line. Putting each block element on its own line and indenting children under their parents makes structural mistakes jump out: a <div> that never closes, a list item outside its list, a script in the wrong place.
What this formatter does (and deliberately does not)
- Block elements such as
div,section,ul,tableandheadeach start a new line and indent their children. - Inline elements such as
a,strong,spanandimgstay inside the line of text they belong to, so the spacing you see on the page does not change. - Script and style blocks are re-indented as a block but their contents are not reformatted, so no JavaScript or CSS can break.
preandtextareaare copied byte for byte, because whitespace inside them is visible on the page.
Format, check, then share
Once the code is readable, run it through the HTML checker for missing tags and broken references, preview it in the HTML viewer, and press Publish as link when it is ready for someone else to see.