HTML Formatter
Indent minified or messy HTML into something readable.
Runs in your browser — nothing you type is sent anywhere
Indentation
Formatted
The result appears here as you type. Nothing is sent anywhere — the work happens in this page.
Whitespace matters inside inline elements, so the formatter will not add a line break where doing so would change how the page renders. A fragment works as well as a full document.
About the HTML Formatter
Minified HTML is a single line thousands of characters long, and HTML produced by a template engine or a CMS is often worse — indented, but by nothing consistent. Either way, working out what is nested inside what means counting tags by hand.
This reindents it properly, using the same formatter that runs in most editors, so the result matches what your colleagues' tools would produce rather than being one more style to argue about.
The important subtlety is inline elements. Whitespace is significant inside a paragraph: putting a link on its own line inserts a space that was not there before, and can visibly change the rendered text. The formatter knows which elements are inline and will not break a line where doing so would change what the page looks like. That is the difference between a formatter and a naive indenter.
A fragment works as well as a complete document, so you can paste the one block you are working on rather than the whole page. Attributes are wrapped when a tag is long, which is what makes a complex element readable.
The parser runs in your browser and is downloaded only when you press the button, so nothing is uploaded and a visitor who reads the page and leaves downloads none of it.
How to use the HTML Formatter
Paste your HTML
A full document or a single fragment — both work.
Choose the indentation
Two spaces, four spaces or tabs, to match whatever the rest of the project uses.
Format it
The parser downloads on the first press and stays for the rest of your visit.
Copy or download
Take the result to the clipboard, or save it as an .html file.
Frequently asked questions
Will formatting change how my page looks?
Can I format just a fragment?
Does it fix broken HTML?
Does it handle templates?
Is my HTML uploaded?
You may also need
CSS Formatter
Expand minified CSS back into readable rules.
JavaScript Formatter
Make minified or badly formatted JavaScript readable again.
XML Formatter
Indent XML properly, and be told when a tag is closed in the wrong place.
JSON Formatter
Format, validate and minify JSON — with the exact line and column of any error.