XML Formatter

Your text never leaves your browser — everything runs on your device.

Paste XML and get it back neatly indented with 2 spaces per level, so nested elements are easy to read. The formatter also checks that your XML is well-formed — matching opening and closing tags, quoted attributes, and a single root element — and reports the exact line and column of any problem. Free, no signup, and your text never leaves your browser.

Frequently asked questions

What does "well-formed" XML mean?

Well-formed XML follows the basic syntax rules: every opening tag has a matching closing tag, tags nest properly, attribute values are quoted, and there is exactly one root element. A document can be well-formed without matching any particular schema.

Is my XML sent to a server?

No. Formatting and validation run entirely in your browser. Your XML is never uploaded or stored.

Why does the formatter report a mismatched tag?

It means a closing tag does not match the most recently opened tag — for example <book><title></book> closes "book" while "title" is still open. Close the inner tag first, then the outer one.

Does it handle XML declarations and comments?

Yes. XML declarations, comments, CDATA sections and processing instructions are kept in place and shown on their own lines.