XML Formatter
Format, validate, minify and convert XML. Syntax highlight, XML to JSON, stats, and tree view.
XML Quick Reference
About this tool
XML (eXtensible Markup Language) is the tagged, hierarchical format behind RSS feeds, SOAP APIs, Office documents, SVG, and many configuration files. A formatter takes minified or hand-typed XML and re-indents it so the nesting is visible, which is the fastest way to spot a missing closing tag or a misaligned attribute.
Example: paste <note><to>Tove</to><from>Jani</from></note> and click Beautify (2sp) to get each element on its own line with consistent indentation. Click Minify to strip all whitespace again for the smallest possible payload size.
The XML to JSON mode converts the document into a JavaScript object using the common convention where attributes become @name keys and text content becomes #text. The Tree mode renders a collapsible outline that mirrors the element structure, and the stats panel reports element counts, attribute counts, and file size.
FAQ
What is the difference between well-formed and valid XML? ›
Well-formed means the document follows XML syntax rules — every tag is closed, attributes are quoted, there is exactly one root element. This tool checks well-formedness. Valid means it also conforms to a schema (DTD or XSD) that defines which elements and attributes are allowed. Schema validation requires an external schema file and is not part of this tool.
Why did my XML fail to parse? ›
The most common causes are an unclosed tag, an unescaped ampersand (use & instead of &), a missing quote on an attribute value, or more than one root element. The error message from the parser points to the line and character where it gave up, which is usually near the actual problem.
How does the XML to JSON conversion handle attributes? ›
Attributes are prefixed with an @ symbol (so <item id="3"> becomes {"@id":"3"}), text content is placed under a #text key, and repeated child elements become arrays. This is the same convention used by popular libraries such as xml2js and fast-xml-parser.
Does this tool send my XML anywhere? ›
No. Parsing, formatting, and conversion all happen in the browser using the built-in DOMParser. The XML never leaves your machine, which makes the tool safe for confidential configuration files and production data.
How is this different from the JSON ↔ XML Converter? ›
The JSON ↔ XML Converter is a dedicated bidirectional tool with support for custom root elements, @-prefixed attribute handling, and array-to-element conventions. This tool treats XML→JSON as a convenience mode alongside formatting, tree view, and validation — use it when you need to inspect or clean up XML and get the JSON as a side product.