XML Formatter & Validator

Format XML online free — pretty-print or minify, with well-formedness checking. Keeps mixed content, entities and CDATA exactly as written, all in your browser.

Runs in your browserNothing uploadedFree · no signup

An element that mixes text with tags, like <p>Hello <b>world</b>!</p>, is kept on one line — indenting its children would add line breaks to the text itself. Entities, CDATA sections and anything under xml:space="preserve" are left exactly as you wrote them.

Frequently asked questions

Does formatting change what my XML means?
No, and that is the part most formatters get wrong. The only whitespace ever removed is whitespace-only text sitting between elements, which is what indentation replaces. An element that holds any real text — including one that mixes text with tags, like a paragraph with a bold word inside it — is written on a single line with its text untouched, because pushing its children onto separate lines would insert line breaks into the text itself. Entities such as &amp;#233; are passed through as written rather than decoded, CDATA sections are copied verbatim, and anything marked xml:space="preserve" is left completely alone.
What does the well-formedness check look for?
Everything that stops a real XML parser: a closing tag that does not match its opening tag, a tag that is never closed, a bare & that should be &amp;amp;, a < inside an attribute value, an attribute with no value or with an unquoted one, the same attribute twice on one element, text outside the root element, an unterminated comment or CDATA section, a comment containing --, and an XML declaration that is not the first thing in the file. Each error names the problem and gives you the line and column, so you can go straight to it.
Why is my text value indented differently from the tags around it?
Because a text value that runs over several lines is copied exactly as you wrote it. The tool re-indents markup, never character data, so the interior lines of a long text value keep their original spacing. The 'Trim spaces and line breaks around text values' option cleans up the whitespace at the two ends of a value — turning a name spread over three lines into a single tidy line — and you can switch it off to get a byte-exact result, which matters for signed or canonicalised documents.
What is the difference between beautify and minify?
Beautify adds indentation and line breaks so the structure is readable; minify removes them, putting the whole document on one line to save bytes over the wire. Both make exactly the same guarantees about your content, so a document can be minified for transport and beautified again later without drifting. Minify also reports how many characters it saved.
Is my XML uploaded anywhere?
No. The XML is parsed and formatted entirely in your browser and nothing is sent to a server, so a SOAP request, an API response or a config file holding hostnames and keys never leaves your device.