Category: Developer

XML Formatter

Format, indent or minify XML without uploading it.

Runs in your browserProcessed locally. Your input never leaves your device.

Details

About this tool

Paste an XML document and get a clean, consistently indented version immediately. Choose two spaces, four spaces, tabs or minified output. The formatter checks the syntax first and reports the line and column when the document cannot be parsed.

Readable indentation exposes the document structure: parent and child elements line up, namespaces remain attached to their declarations, and comments stay in their original order. This makes API payloads, configuration files, SOAP messages and exported documents much easier to inspect or compare.

XML whitespace can carry meaning, unlike whitespace in JSON. For that reason mixed text, CDATA sections and elements marked with xml:space="preserve" are kept intact instead of being reformatted destructively. Minification removes whitespace-only nodes between child elements, so use regular formatting when the receiving system treats indentation as data.

Formatting is not schema validation. A document can be readable and syntactically correct while still violating an XSD contract. Use the XML Validator for syntax diagnostics and the XML + XSD Validator when the receiving system requires a particular structure.

Everything runs locally in your browser. The document is not uploaded, DTD declarations are rejected, external entities are never resolved and the formatter makes no network request.

Keep going

  • Check whether XML is well-formed and pinpoint syntax errors.

    Runs in your browserDeveloper
  • Run an XPath expression against XML and see what it matches.

    Runs in your browserDeveloper

Good to know

Questions people actually ask

Is my XML uploaded to a server?
No. Parsing and formatting run in your browser, so the document never leaves your device. DTD declarations are rejected and external entities are never resolved.
Does formatting change XML data?
The formatter preserves element text, attributes, namespaces, comments and CDATA. It also leaves mixed content and xml:space="preserve" sections intact because inserting whitespace there could change the value read by another system.
Can I minify XML?
Yes. Choose Minified to remove whitespace-only nodes between child elements. Mixed text, CDATA and xml:space="preserve" content remain intact. If the receiving system treats indentation whitespace as data, use regular formatting instead.
Does this validate XML against XSD?
No. It checks that XML can be parsed and reports syntax errors. Use the XML + XSD Validator to check required elements, order, namespaces and data types against a schema.