Something wrong with this tool?
About HTML Formatter Online
This tool reformats HTML source for readability. It re-indents nested tags, breaks long lines, normalises spacing inside attributes, and produces output that's easy to scan and edit. Optional minification mode strips whitespace for the smallest possible output.
Useful when inspecting view source on a production page (where everything is minified to one line), preparing HTML for a code review, generating consistent output across your team, or producing minified HTML for production deployment.
The formatter understands HTML5 void elements (br, img, input, etc.), preserves the contents of <pre>, <script>, and <textarea> elements verbatim, and handles inline elements differently from block-level elements to keep word flow intact.
How to use this tool
How to pretty-print minified or jumbled HTML
Paste the HTML
Drop the minified or hand-written-but-messy HTML into the "HTML" field. Both full documents (with `<!doctype>`) and fragments are accepted.
Press Run
Result returns a single `formatted` field. Two-space indentation, one tag per line at structural breaks. Inline-level elements stay on one line when adjacent to text, so `<p>Hi <strong>there</strong></p>` doesn't sprout three lines.
What gets preserved
Attributes stay on the same line as the opening tag — no wrapping when there are many attributes. Comments (`<!-- … -->`), `<script>`, `<style>`, and `<pre>` contents pass through verbatim to avoid corrupting JS or whitespace-sensitive text.
Round-trip considerations
Format for review, then minify before deploy. The formatter is forgiving of invalid HTML, so a tag missed at input may quietly close earlier than you expect in output. Validate with the W3C validator after formatting if the input was suspect.