navaja.dev / xml

XML formatter

Paste XML to pretty-print it, minify it, check it's well-formed or convert it to JSON. Nothing leaves your browser.

Indent

What the XML formatter does

Common XML errors

ErrorFix
Unexpected entity: nbspXML only knows & < > " '. Use   instead.
Tag doesn't matchEvery <tag> needs a matching </tag>, closed in reverse order.
Only one root elementWrap everything in a single outer element.
Unquoted attributeAttribute values need quotes: id="1".
A bare & in textWrite &amp;, or wrap the text in <![CDATA[ ... ]]>.

Questions

Is my XML uploaded?

No. Formatting, validation and conversion happen in your browser.

Does it validate against an XSD schema?

No. It checks that the XML is well-formed (correct syntax), which catches most mistakes. Schema validation needs the schema and a validating parser.

Will formatting change my data?

Whitespace-only text between tags is removed or re-indented, and Format trims text-only elements. Mixed content (text next to tags), elements with xml:space="preserve", CDATA, comments and attribute values are kept exactly. If a space between two tags matters, as in <b>bold</b> <i>italic</i>, put it inside the text or use xml:space="preserve".

Can I format SVG, RSS, Android or Maven files?

Yes. They're all XML: SVG images, RSS and Atom feeds, Android layouts, pom.xml, .csproj, plist and config files.

How are attributes shown in JSON?

As keys starting with @, like "@id": "bk101". Text next to child elements goes in #text.