XML Formatter

Input

Output

About the XML Formatter

An XML formatter and validator built on the browser's own DOMParser — paste XML to get a clearly indented, readable version, or switch to Minify for the smallest valid form. Malformed XML gets a clear, specific error message instead of silently mangled output.

Because it uses the same parser a real browser uses to load XML documents, the validation you get here matches what will actually happen when that XML is loaded elsewhere — not a simplified approximation. That makes it useful for cleaning up API responses, RSS/Atom feeds, SOAP payloads, and config files like pom.xml or web.config before committing them.

How to Use the XML Formatter

1

Paste XML into the input panel.

2

Switch between Formatted and Minified views.

3

Fix any reported syntax error at the exact location flagged, then copy the result.

Frequently Asked Questions

Is my XML sent anywhere?

No. Parsing, validation, and formatting all happen locally in your browser using the built-in DOMParser — nothing is sent to a server.

What counts as "invalid" XML here?

Anything that isn't well-formed — unclosed tags, mismatched tags, invalid characters, or a bare "&" that isn't part of a valid entity reference. The error message comes directly from the browser's own XML parser, the same one it uses to load real XML documents.

Are comments and CDATA sections preserved?

Yes — comments, CDATA sections, processing instructions, and the XML declaration (if present) are all preserved exactly through formatting and minifying.

How does Minify differ from Format?

Format re-indents the document with two-space indentation for readability. Minify strips all insignificant whitespace between tags to produce the smallest valid representation of the same document.

Does it validate against a schema (XSD/DTD)?

No — it checks that the XML is well-formed (correct tag structure and syntax), not that it conforms to a particular schema. Schema validation needs the actual XSD/DTD as a second input, which is outside what a general-purpose formatter does.