json.

XML Formatter Online

Format, validate, minify, and convert XML ↔ JSON — processed locally in your browser.

Processed locally in your browser — never uploaded.

Input

Output

Ctrl+Enter to format · Upload or drop .xml / .json / .txt on the input panel

What is an XML Formatter?

An XML formatter takes compact or minified XML and rewrites it with proper indentation and line breaks, making nested tags and attributes easy to read and debug — all without leaving your browser.

Use Validate for parse errors, Minify for compact payloads, and XML ↔ JSON when you need to bridge APIs that mix both formats.

Unlike JSON, XML has no single universal minified form for whitespace — text nodes inside elements can be semantically significant (<p>Hello world</p> vs <p>Hello world</p> may render differently), so this formatter only collapses whitespace between tags, not inside text content. XML also requires escaping five reserved characters — &, <, >, ", and ' — as entities (&amp;, &lt;, etc.); a raw & in Tom & Jerrywill fail to parse until it's written as Tom &amp; Jerry, one of the most common reasons XML → JSON conversion throws a parse error.

Also try the JSON formatter, JSON validator, JSON minifier, or JSON viewer.

XML Formatter FAQ

Is my XML data safe?
Yes. Formatting, validation, minify, and XML↔JSON conversion run locally in your browser. Your XML is not uploaded to our server.
Can I validate malformed XML?
Yes. Validate uses the browser XML parser and reports parse errors so you can fix unclosed tags and syntax issues.
Can I convert XML to JSON?
Yes. Use XML → JSON to turn elements and attributes into structured JSON, or JSON → XML to go the other way — useful when APIs mix both formats.
How do I minify XML?
Click Minify to remove insignificant whitespace between tags while keeping a valid document. Use Format again when you need readable indentation.