XML Formatter, Validator & Pretty Print

Paste XML to pretty-print it with 2 spaces, 4 spaces or tabs, or minify it to one line. Well-formedness is checked first: an error shows its exact line and column. Comments, CDATA and the XML declaration are kept as written. External entities and DTDs are never fetched. Nothing leaves this tab.

Input
Output
Well-formed XML9 lines261 BValidated on this device

Runs in this tab · nothing is uploaded · Verify in 10 seconds →

What the XML Formatter does

An XML formatter pretty-prints compact or minified XML, minifies it back to one line, and reports the first well-formedness error with its line and column. Use it for SOAP payloads, SAML assertions, UBL/Peppol e-invoices, Android manifests and Maven POMs. Beautify XML, XML pretty print and format XML are the same operation: re-indent between tags without changing the data.

How the XML Formatter works

Paste XML, drop a .xml file, or load the sample. Format rewrites with the indent you pick: 2 spaces (default), 4 spaces or tabs. Minify removes whitespace between tags. Well-formedness is checked first with fast-xml-parser's validator; a failure shows the first error's exact line and column. Formatting is a tokenizer that only re-indents between tags, so text, attributes, comments, CDATA, processing instructions, the XML declaration and DOCTYPE stay as written. External entities and DTDs are never fetched. Nothing is uploaded.

Limits

Checks well-formedness only, not XSD/DTD schema validity. Files up to ~50 MB.

~/faq

Frequently asked questions

Does this upload my XML?

No. Parsing and formatting run in this tab, and there's no endpoint that receives the text. You can verify it in DevTools → Network.

Is the XML validator a full XSD schema validator?

No. It checks well-formedness: one root, matching tags, quoted attributes and escaped & < >. It does not apply an XSD or DTD, and it never fetches an external schema. Valid XML would also have to match a schema; that is a later check this page does not run.

How do I format (pretty-print) XML?

Paste it, pick an indent and press Format (Ctrl/Cmd + Enter). This also covers "beautify XML" and "XML pretty print": all three are the same operation.

How do I validate XML and find the error?

The status bar shows the first well-formedness error with line and column. Common causes: an unclosed tag, a raw & (use &amp;), mismatched case, or more than one root element.

Does formatting change my data?

Only whitespace between tags changes. Text content, attributes, comments and CDATA stay the same. Whitespace inside mixed content (`xml:space="preserve"`) is left alone.

Is it safe to paste SOAP, SAML or e-invoice XML?

The document never leaves the device. External entities and DTDs are not resolved, so XXE-style payloads can't fetch anything.