🏷️XML Formatter & Validator - Beautify, Minify and Convert XML ↔ JSON
XML from API responses, SOAP envelopes, Android layouts, Maven pom.xml files, RSS feeds or logs often arrives squeezed onto one line. Paste it here for neatly indented XML: one element per line, text-only elements kept on a single line, mixed content such as <p>Hello <b>world</b></p> preserved intact, and comments, CDATA sections, processing instructions and DOCTYPE left untouched; elements with many attributes can list one attribute per line. Minify removes whitespace between tags (and optionally comments) and shows the size before and after. The browser's built-in XML parser validates your document as you type, pointing to the line and column of mismatched tags, unquoted attributes or illegal characters. You can also convert XML to JSON — attributes become "@name", text becomes "#text", repeated elements become arrays and numbers or booleans can be typed automatically — or turn JSON back into XML.
Free · No sign-up · Runs in your browserLast updated:
How to use XML Formatter
- 1Choose Beautify, Minify, XML → JSON or JSON → XML
- 2Paste XML (or JSON) and set indent, attribute wrapping and comment options
- 3Check the validation result, then copy or download the output
FAQ
- Does formatting change my XML?
- Elements, attributes and text are unchanged; only indentation and line breaks between tags are adjusted. Mixed-content elements stay on one line so no extra whitespace is inserted into text. If your document depends on whitespace between tags (for example xml:space="preserve"), keep the original.
- How is XML converted to JSON?
- Each element becomes a JSON key; attributes are written as "@name" and text as "#text"; repeated child elements are collected into an array; text-only elements without attributes become plain strings, and empty elements become null. With type conversion on, text such as "42" or "true" becomes a number or boolean.
- Why does it say my XML is not well-formed?
- XML is strict: every start tag needs a matching, correctly nested end tag, attribute values must be quoted, there can be only one root element, and & and < in text must be written as & and <. The reported line and column show where the parser noticed the problem, which is usually at or just after the mistake.
- Is my data uploaded?
- No. Formatting, validation and conversion all happen locally in your browser, so API payloads and configuration files never leave your computer.