XML Formatter

Beautify, minify and validate XML, and convert XML ↔ JSON.

Your XML is parsed and formatted locally in your browser and nothing is uploaded to a server.

Working with JSON too? Try the JSON Formatter.

About XML Formatter

This xml formatter beautifies, minifies and validates XML and converts between XML and JSON, all processed locally in your browser. Paste a document and pretty-print it with clean two-space indentation, collapse it to a single minified line, or use the built-in xml validator to confirm it is well-formed with the exact line and column of the first problem. The XML to JSON mode keeps attributes distinct using an @_ prefix so they round-trip cleanly, and the JSON to XML mode rebuilds markup from an object. Attributes and comments are preserved when you reformat. It is built for developers, QA engineers and integration teams working with config files, SOAP payloads, RSS feeds and API responses who need a quick xml beautifier or to format xml online without uploading sensitive data anywhere.

Features

How to use the XML Formatter

  1. Paste your XML (or JSON for JSON to XML) into the input box.
  2. Choose a mode: Beautify, Minify, Validate, XML to JSON or JSON to XML.
  3. Read the formatted result, validation message or converted output in the output panel.
  4. Copy the output or download it as data.xml or data.json.

Example

Input

<note id="1"><to>Tove</to><from>Jani</from></note>

Output

<note id="1">
  <to>Tove</to>
  <from>Jani</from>
</note>

Beautify mode adds two-space indentation while keeping the id attribute.

Common errors & troubleshooting

Frequently asked questions

What is the XML Formatter used for?
The XML Formatter beautifies, minifies and validates XML and converts between XML and JSON, so you can clean up config files, SOAP payloads, RSS feeds or API responses in one place.
How do I convert XML to JSON with the XML Formatter?
Switch to XML to JSON mode and paste your document. Attributes are kept with an @_ prefix (for example @_id) so they round-trip distinctly from child elements when you convert back to XML.
What does the Validate mode check?
It checks that the document is well-formed, meaning matching tags and valid nesting, and reports the line and column of the first problem it finds.
Does the XML Formatter preserve comments and attributes?
Yes. Both element attributes and comments are preserved when you beautify or minify the document.
Can the XML Formatter convert JSON back into XML?
Yes. Switch to JSON to XML mode and paste a JSON object to rebuild XML markup from it, using @_ prefixed keys for any attributes.
Is my XML uploaded anywhere when I use the XML Formatter?
No. The XML Formatter runs entirely in your browser, so your data never leaves your device.

Related tools

All ArrayKit tools