HTML Formatter / Validator
Paste in minified, generated or hand-edited HTML and get back something indented and readable, with unclosed and mismatched tags called out by name — not just "something's wrong somewhere." Content inside <script>, <style>, <pre> and <textarea> is left untouched, since reformatting it would change what those tags are supposed to preserve.
Why HTML validation isn't as simple as XML's
Browsers are deliberately forgiving of broken HTML — a missing closing tag, an unquoted attribute, or an element nested somewhere it technically shouldn't be will usually still render something, because the HTML parsing spec includes explicit error-recovery rules for exactly these cases. That's great for browsing the web; it's a problem for finding your own mistakes, because the browser silently fixes them instead of telling you they happened. This tool instead walks the actual tag structure looking for the specific problems that are always worth fixing even though a browser would tolerate them.
What gets flagged
- A tag that's opened but never closed — easy to lose track of in deeply nested markup
- A closing tag that doesn't match what's actually open —
<div>...</section> - A stray closing tag with nothing open to match it at all
Void elements — br, img, input, hr, meta, link and the others that never take a closing tag — are recognised automatically and never flagged as unclosed.
Beautify vs. minify, and when each one matters
Prettified HTML is for reading and editing — reviewing a template, debugging a layout, or checking what a server actually rendered. Minified HTML is for shipping — every byte of whitespace between tags is overhead that a real user's browser downloads and parses on every page load, and while a single page's whitespace is trivially small, it adds up in aggregate across a high-traffic site the same way an unoptimised image does, just with a much smaller per-request cost.