Skip to content
Dev

XML Formatter

This XML formatter pretty-prints, validates, and minifies XML in your browser. It checks that tags are well formed, points to the line of the first error, and indents with 2 spaces, 4 spaces, or tabs.

Paste or drop XML. Formatting and checks run in your browser only.

Used by Format. Choose 2 spaces, 4 spaces, or tabs.

Status

Paste XML, then click Format or Minify. Errors name the line of the first problem.

Pretty-printed or minified XML appears here. Copy and Download use this text when it is not empty.

How to use

  1. Paste XML into the box, or drop an XML file onto it.
  2. Choose 2 spaces, 4 spaces, or tabs.
  3. Click Format to re-indent every nested element, or Minify to strip whitespace between tags.
  4. Copy or download the result. If the XML is not well formed, the line of the first error is shown.

How it works

Format parses the document and checks matching tags, quoted attributes, and a single root element, then reprints each nested element at the indent you chose. Minify removes whitespace between tags and writes one compact line. Text inside a tag is kept. The check is well-formedness only and does not validate against an XSD schema. Nothing is uploaded.

Example. The markup <note><to>Sam</to></note> with 2-space indent prints note, then to on the next line indented two spaces with the text Sam, then the closing note tag.

Well-formed, not a schema

The check looks for matching tags, quoted attributes, and one root element, then shows the line of the first problem. It does not validate against an XSD schema. Parsing stays in your browser.

Frequently asked questions

How do I format XML online?

Paste your XML into the box and click Format. The tool re-indents every nested element and shows the cleaned result you can copy or download.

Does this validate my XML?

It checks that the XML is well formed (matching tags, quoted attributes, one root element) and shows the line of the first error. It does not validate against an XSD schema.

Is my XML uploaded to a server?

No. Parsing and formatting happen in your browser, so private config files never leave your device.

Can I minify XML too?

Yes. Switch to Minify to strip whitespace between tags and produce a single compact line.

What indentation options are there?

You can choose 2 spaces, 4 spaces, or tabs.