HTML Formatter
Format and indent messy HTML for readability.
Paste HTML to format it with clean indentation.
About HTML Formatter
Paste one-line or minified HTML and get it back cleanly indented so the nesting is readable. Handles attributes, self-closing tags, and script blocks, with 2 or 4 space indentation, entirely in your browser.
What this tool does
Paste any HTML and it gets reformatted with consistent indentation and line breaks. Nested elements are indented so you can see the document structure at a glance. It handles self-closing tags, attributes, inline styles, and script blocks correctly.
When you'd use this
- You've copied HTML from a website's view-source and it's all on one line
- Or you're debugging a template and need to see the nesting
- Or you've minified your markup for production and need to read it again
- Paste it here instead of manually adding line breaks
How it works
The formatter parses your HTML and rebuilds it with proper indentation. It preserves your content and attributes while adding line breaks between elements. Pick 2 or 4 spaces depending on your preference, copy the result, and paste it back into your editor.