What is XML formatting?
XML formatting (pretty-printing) adds consistent indentation and line breaks so nested elements, attributes, and text are easy to scan. It does not change the data model of the document—only how it is laid out. Minification does the opposite: it removes non-essential whitespace between tags to shrink payloads for storage or transport.
This tool uses your browser’s native parser, so you get fast feedback without installing desktop software or uploading files to a server.
How to use this tool
- Paste XML into Input, or load the sample with Sample XML.
- Click Format for 2-space indented output, or Minify for a compact single-line-style document.
- Use XML → JSON to inspect structure as JSON; use JSON → XML when your input is JSON with a single root property matching this tool’s output shape.
- Click Validate to confirm the input is well-formed; errors appear inline under the actions.
- Copy results from the Output pane with Copy.
XML and JSON conversion model
Conversion here is structural and opinionated: element names become object keys, text nodes map to _text, and attributes map to _attr. Repeated siblings share a key and become a JSON array on the way out, and arrays round-trip back into repeated elements on the way in.
Namespaces, processing instructions beyond the usual declaration, and mixed content with complex whitespace may need manual cleanup after conversion. Treat this as a developer utility for quick transforms, not a full data-binding or schema-validation pipeline.
Privacy and limits
All work happens locally in the tab. Input length is capped to keep the UI responsive on very large documents. If you hit the limit, trim the file or process it in chunks.
For untrusted XML, avoid enabling features elsewhere that resolve external entities; this page does not fetch external DTDs, but good hygiene still applies when you paste data from unknown sources.