How to Use the HTML/XML Indent Formatter
Markup that's been minified in a build step, or code that got pasted in as a single long line, is very hard to read visually. Paste that minified code here and this tool analyzes the opening and closing tags to automatically break lines and indent them according to the actual tag hierarchy, turning it back into readable, well-structured markup.
Whenever it encounters a closing tag, the indentation level drops by one; whenever it encounters an opening tag, the following lines are indented one level deeper. Self-closing tags like <br/> and <img/>, or tags that open and close on the same line, stay at the current level on a single line instead of adding unnecessary depth.
You can choose between 2 or 4 spaces for the indent size, so the output can match your project's code style guide.
Frequently Asked Questions
Yes, tags that include a closing slash don't increase the indentation level and are kept on a single line at the same depth.
Yes, you can choose between 2 or 4 spaces, and the output re-formats instantly based on your choice.