XML Formatter and Validator
Indent one-line XML so you can read it, and see the line and column of any broken tag
Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.
Did this tool do the job?
Thanks, your feedback came through.
How it works
API responses, SOAP messages and exported config files usually arrive squeezed onto one line. Paste the text into the left pane and every tag moves to its own line, with nesting shown by indentation. A 3 KB single-line order response, for example, opens up into roughly 90 readable lines with 2-space indentation, and you can see at a glance which item belongs to which order. The same pass checks that the document is well formed. If a tag is never closed, closes in the wrong order, or an attribute value has no quotes, you get no output but a message such as "</order> appears on line 4, but the open tag is <item> (line 3)", followed by the exact column. The reverse works too: "Minified — one line" strips the indentation between tags so the document gets smaller, and removing comments shrinks it further. The result line shows the size before and after. Text with tags inside it (Pay <b>cash</b> on delivery) and CDATA sections are kept exactly as they were.
This tool is also known as xml formatter, xml beautifier, xml validator, xml minify, xml pretty print, soap formatter, format xml online.
What is XML?
XML writes data as nested <tag>value</tag> pairs, and it sits behind SOAP web services, RSS feeds, SVG images, Office files and countless configuration files. To a parser, whitespace between tags means nothing, which is why programs often write XML on one line. To a person, indentation that mirrors the nesting is the only practical way to read it. Formatting changes that whitespace and nothing else.
What is Well-formed XML?
Well-formed XML follows the basic syntax rules: every opening tag has a closing tag, nested tags close in reverse order, there is a single root element and attribute values sit in quotes. Break any of these and no XML program will open the file. Valid XML goes one step further and also matches a schema (XSD or DTD). This tool checks the first, not the second.
What is the difference between formatting and minifying XML?
Formatting writes for people: one tag per line, indentation that shows the nesting, and a larger file. Minifying writes for machines: whitespace and line breaks between tags go away, comments can be removed too, and the file gets smaller and travels faster. The data is identical in both: the same tags, attributes and text. Use the indented version to read or debug, and the one-line version to send to a service or paste into a single-line field.
What formatting never changes
Indentation is only added where the gap between tags is pure whitespace. When an element holds real text and tags side by side (mixed content, like "Pay <b>cash</b> on delivery"), adding a line break would change the text, so the inside of that element is written byte for byte as it was. Elements marked xml:space="preserve" and everything below them are treated the same way, and CDATA sections are never touched.
Attributes keep their original order, their quote style and their raw spelling: entities such as & are not decoded and re-encoded, and <a/> stays <a/> while <a></a> stays <a></a>. The DOCTYPE and the <?xml …?> line pass through unchanged. Format and then minify again, and you get the same tree back.
What the validator checks, and what it does not
This is a well-formedness check: every opened tag is closed, tags close in reverse order, there is exactly one root element, attribute values are quoted, no attribute appears twice, and comments and CDATA sections are closed. Errors come with both line and column, because in a minified file the column is the only way to find the spot.
It does not validate against a schema (XSD or DTD). A UBL invoice can be perfectly well formed and still miss a field the schema requires; this tool cannot tell you that. Custom entities declared in a DTD are not expanded, for safety; only & < > " ' and numeric character references are recognized.
Frequently asked questions
How do I make an XML file readable?
Paste the XML into the left pane on this page. Each tag moves to its own line and nested levels are indented with 2 spaces. Change "Output layout" for 4 spaces or tabs, then copy the result or download it as an .xml file.
How can I check whether my XML is valid?
Paste it here. If the document is well formed, the result line says "Well formed". If not, no output is produced and you see the name of the unclosed or mismatched tag with its line and column. Schema (XSD) validation is not done; only the tag structure is checked.
How do I minify XML to a single line?
Set "Output layout" to "Minified — one line". Line breaks and indentation between tags are removed, while spaces inside text are left alone. Set "Comments" to "Remove" to drop comments as well; the result line shows the size before and after.
Does it work for SOAP, SVG or RSS?
Yes. SOAP envelopes, WSDL, SVG, XAML, RSS and UBL invoices are all XML, and namespace prefixes like soap: or svg: are kept as they are. Formatting follows the tag structure, so the file type does not matter.