Developer Tools
Free Online HTML Formatter
Paste HTML below to automatically indent nested tags and make the markup easy to read.
How to use the hTML Formatter
- Paste your HTML into the input box.
- Choose an indentation size.
- Click 'Format HTML'.
- Copy the neatly indented result.
Example
Minified markup like <div><p>Hi</p></div> is reformatted with each tag on its own indented line, making the nesting structure clear at a glance.
Why format HTML?
Minified or copy-pasted HTML often arrives as one long line, making it nearly impossible to read or debug. Formatting restores clear indentation so you can see the tag structure immediately.
A lightweight, best-effort formatter
This tool uses simple structural rules to indent based on nesting depth. It's designed for everyday markup cleanup rather than as a full HTML validator — for production code, always double-check the output.
Frequently asked questions
No, this is a formatter, not a validator — it indents based on tag structure but doesn't check for HTML spec compliance.
No, only whitespace and indentation are added; tags, attributes and content are preserved.
Yes, paste the entire document and it will be indented as a whole.
No, formatting happens entirely in your browser.