Home/Developer Tools/XML Tools
📋

XML Tools

FREE

Beautify, validate and convert XML to JSON

Free · No sign-up required
Loading...

What the XML tools do

XML still underpins a great deal of software: SOAP and enterprise APIs, RSS and Atom feeds, sitemaps, Android layouts and manifests, Maven and NuGet configs, SVG, Office documents and invoicing standards. This tool validates an XML document for well-formedness, beautifies it with proper indentation, and converts it to JSON so it can be read or processed by tools that only speak JSON. Parsing uses the browser's built-in XML parser and nothing is uploaded.

Well-formed vs valid

XML has two levels of correctness. A document is well-formed when it follows the basic rules: a single root element, every tag closed, tags properly nested, attribute values quoted, special characters escaped. It is valid when it also conforms to a schema (DTD, XSD or RelaxNG) describing which elements are allowed where. This tool checks well-formedness — the level at which parsers refuse to read a file at all. Schema validation needs the schema and a tool such as xmllint or an IDE.

RuleWrongRight
Close every element<item>text<item>text</item>
Nest properly<b><i>text</b></i><b><i>text</i></b>
Quote attributes<a href=x><a href="x">
Escape & < ><p>Tom & Jerry</p><p>Tom &amp; Jerry</p>
One root element<a/><b/><root><a/><b/></root>
Case-sensitive names<Item></item><item></item>

Beautify: what changes

Before: <order id="42"><customer><name>Ana</name><email>ana@example.com</email></customer><items><item sku="A1" qty="2"/></items></order> After: <order id="42"> <customer> <name>Ana</name> <email>ana@example.com</email> </customer> <items> <item sku="A1" qty="2"/> </items> </order>

Elements are indented by nesting depth, one element per line, with text-only elements kept on a single line. Attribute order, comments, CDATA sections and processing instructions are preserved. Whitespace inside text content is left alone, since in XML it can be significant.

Convert to JSON

XML and JSON do not map one-to-one, so the converter follows common conventions: elements become object keys, repeated elements become arrays, attributes are stored with an @ prefix, and text content of an element that also has attributes goes under #text.

<item sku="A1" qty="2">Widget</item> { "item": { "@sku": "A1", "@qty": "2", "#text": "Widget" } }
  • All values come out as strings — XML has no numeric type. Convert in your code if needed.
  • Namespaces are kept in the key names (soap:Body).
  • A single child that might repeat in other documents will appear as an object, not a one-element array; handle both in consuming code.
  • Comments and processing instructions are dropped.

Common uses

  • Reading a SOAP response or an RSS feed pulled from a log.
  • Cleaning up a minified sitemap or a hand-edited Android manifest.
  • Finding the unclosed tag that makes a config file fail to load.
  • Turning an XML export into JSON for a script or a spreadsheet import.
  • Inspecting the structure of an SVG or an Office document part.

Frequently asked questions

The validator says my file is fine but the application rejects it.

The file is well-formed but probably not valid against the application's schema — a required element is missing or in the wrong place. Check the schema or the application's error message.

Why do & and < in my text cause errors?

They are reserved. Write &amp; and &lt; (and &gt; for >), or wrap the text in a CDATA section: <![CDATA[ … ]]>.

Does it handle large files?

Files of several megabytes are fine in a desktop browser. Very large exports (hundreds of MB) should be processed with command-line tools.

Can I convert JSON back to XML?

Use the JSON Converter tool, which offers XML output.

Is the declaration <?xml version="1.0"?> required?

No, but it is recommended, especially to declare an encoding other than UTF-8. The beautifier keeps it if present.

Is my XML uploaded?

No. Parsing uses the browser's DOMParser and runs locally.

More tools in this category

📋
JSON Tools
View tree, format, validate and minify JSON
📄
YAML Beautifier & Validator
Format YAML and find the line that breaks it
🗃
SQL Formatter & Minifier
Lay out SQL clause by clause, or collapse it to one line
📝
Markdown Tools
Preview Markdown, convert to HTML and generate tables
🔑
JWT Encoder & Decoder
Decode a JWT's header and payload, or sign one with HS256
🔐
URL & Base64 Encoder / Decoder
Percent-encode for URLs or convert to and from Base64