How to Format & Validate
XML Online Free
Prettify minified XML, catch syntax errors with line numbers, minify back for transport. Browser-only.
Open XML FormatterWhy a dedicated XML formatter?
XML is harder to read than JSON when minified — closing tags add to the visual noise, and namespace prefixes make every element name twice as long. A 300-character SOAP envelope on one line is unreadable. Properly indented, it's a 30-second skim.
And unlike JSON, XML errors are often subtle — an unescaped ampersand inside an attribute, a closing tag with the wrong case, a CDATA block missing its closing bracket. A formatter that runs DOMParser tells you about these immediately, with line numbers, before you waste time debugging the consumer.
Step-by-step: format XML in seconds
Open the XML Formatter
Visit the free XML Formatter. It runs right inside your browser tab — your markup is never uploaded. Validation uses the browser's built-in DOMParser; beautify and minify run as fast local text passes.
Paste raw XML into the input
Drop in any XML — SOAP envelopes, RSS/Atom feeds, SVG markup, sitemap files, OOXML fragments. Beautify re-indents the element tree; use Validate to check well-formedness via DOMParser.
Beautify or minify
Beautify indents the tree with two spaces per level for readability; Minify strips insignificant whitespace back to a single line for transport. Validate reports the first well-formedness error with its location.
Read errors with line numbers
If the XML is malformed, the parser reports the exact line and column. Common issues: unclosed tags, mismatched element names, ampersands not escaped as &, or invalid characters in attribute values.
Copy or download the formatted output
Click Copy to grab the prettified XML, or Download to save as .xml. The Minify button does the reverse — collapses to one line for transport.
Pro tips
Validate before formatting
Formatting won't fix errors — it just rearranges whitespace. If your XML has a missing close tag, the formatter rejects it and shows you where. Fix the structural error first, then format.
Mind XML namespaces in copy/paste
If you paste a fragment from inside an SVG or SOAP envelope without the parent's namespace declaration, the formatter may complain about an undeclared prefix. Either copy the parent element with its xmlns:... attribute, or add the declaration manually.
Spot-check CDATA and comments
Beautify and minify re-indent the element tree as a fast text pass. If a <![CDATA[...]]> block or comment contains tag-like markup (raw HTML, scripts), review the output to confirm it wasn't reflowed — and keep the original if you need that content preserved byte-for-byte.
Don't format gigabyte-scale XML
DOM parsing loads the entire tree into memory. For very large XML files (50+ MB), use a streaming SAX parser at the command line instead. The formatter is designed for everyday config-file-sized payloads.
SOAP requests with API tokens stay on your device
XML often carries credentials — SOAP security headers, OAuth flows, internal API responses with PII. Format any of it without worrying about it leaving your browser tab.
Frequently asked questions
What's the difference between formatting and validating?
Formatting changes whitespace (indentation, line breaks) without altering the data. Validating checks that the XML is well-formed — properly nested, balanced tags, escaped entities, valid attribute syntax. The formatter does both: validation is a prerequisite for formatting, so you get error reports for free.
Can it validate against an XSD or DTD?
Not currently. The browser's DOMParser checks well-formedness only — it doesn't enforce schema validation. For XSD/DTD validation use a desktop tool like xmllint or oXygen. The formatter is for the much more common case of 'is this XML even parseable'.
Does it handle SOAP, RSS, Atom, SVG?
Yes — they're all just XML with conventions for what the tags mean, and the formatter prettifies any well-formed XML regardless of vocabulary. It works on the element structure, so for documents with large CDATA sections (e.g. Atom entries with embedded HTML, or SVG with inline scripts) it's worth spot-checking that content after formatting.
Why does my XML say 'Extra content at the end'?
XML requires exactly one root element. If your input has two top-level elements (e.g. two <product>s with no enclosing parent), parsers reject it. Wrap in a <root>...</root> or <items>...</items> to give it a single root.
Will my XML be uploaded?
No. Parsing, validating, and formatting all happen client-side in your browser — nothing is uploaded. SOAP requests with API tokens, RSS feeds with email addresses, anything else — none of it is transmitted.
Can I format JSX or HTML?
JSX no — JSX isn't valid XML (unquoted attributes, JS expressions). HTML... usually no — most HTML is not well-formed XML (unclosed <br>, <img> without /, etc.). For HTML, use a Prettier-style HTML formatter. For XHTML it works.