Menu
Dev Tools

XML Formatter & Validator Online Free

Format, validate, and pretty-print XML. Also converts XML to JSON. Browser-based.

Files never storedInstantNo signup

🔒 Your file never leaves your browser. All processing uses the built-in DOMParser.

How to Format XML Online

  1. 1

    Paste your XML

    Paste raw or minified XML into the input box.

  2. 2

    Pick a tab

    Choose Format / Pretty-print for indented XML, Minify for compact XML, or XML to JSON to convert. The output updates instantly; there is no button to click.

  3. 3

    Copy the output

    Click Copy to copy the formatted result to your clipboard.

XML remains the backbone of formats you cannot avoid: RSS and Atom feeds, SVG images, sitemaps, SOAP payloads, Maven and Android build files, Office document internals, and countless enterprise integrations. The problem is that machine-generated XML almost always arrives as a single unreadable line. Formatting it is the difference between scrolling helplessly and actually seeing the document's structure.

Validation built in:unlike a plain pretty-printer, this tool parses your document with the browser's native DOMParser first. Unclosed tags, mismatched nesting, illegal characters, and broken entities are reported as errors instead of silently producing mangled output — making this a quick well-formedness check before you feed a file to a stricter system.

What survives formatting: element and attribute names (including namespace declarations and prefixes), attributes in their original order, comments and CDATA sections inside the root element are kept. The Format tab does not preserve everything, though: comments and processing instructions outside the root element, and processing instructions inside it, are dropped, and an XML declaration is always rewritten as version 1.0, UTF-8 whatever the original said. Entity references such as& are written back as plain characters, so check the result before reusing it. The Minify tab only collapses whitespace in your original text and keeps comments and declarations. If your XML uses whitespace-significant mixed content (rare outside document formats), re-indentation can alter it.

XML to JSON: the conversion tab produces an approximate JSON representation — useful for exploring a payload in JavaScript. It is approximate by necessity: XML attributes, repeated sibling elements, and mixed content have no exact JSON equivalent. For the reverse direction and richer options, see the JSON formatter and YAML to JSON converter.

Frequently Asked Questions

Related Dev Tools