XML Formatter
Indent XML for reading, minify it for transport, and catch errors such as mismatched tags with their exact line.
XML
Formatted XML
Checked and formatted in this browser tab. Nothing is uploaded.
How to use the XML Formatter
- Paste XML, open an .xml or .svg file, or press Sample.
- Press Format (Ctrl + Enter) or Minify.
- If the XML is not well-formed, the error shows the line and column.
- Copy the output or download it.
Example
Input
<catalog><book id="b1"><title>Dune</title><author>Frank Herbert</author></book><book id="b2"><title>Emma</title><author>Jane Austen</author></book></catalog>What it does
- Validates before formatting
- Mismatched or unclosed tags and bad attributes are reported instead of producing broken output.
- Keeps your content
- CDATA sections, comments, processing instructions and attribute order are preserved.
- Short elements stay on one line
- Elements that contain only text stay on one line, so the output is easier to read.
Frequently asked questions
Does it check my XML against a schema (XSD or DTD)?
No. It checks that the XML is well-formed: tags are balanced, attributes are quoted, and there is a single root element. Schema validation is not supported yet.
Can I format SVG, RSS or SOAP messages?
Yes. They are all XML, so the formatter handles them.
Is my code uploaded anywhere?
No. The parser and printer run in your browser. Your code is never sent to a server, logged or stored.