Data Tools
XML Formatter
Format and beautify XML data. Free online tool — runs in your browser, no sign-up required.
See how to use this toolXML Formatter
Data is converted locally in your browser without server upload.
About XML Formatter
XML Formatter pretty-prints minified XML into an indented tree and validates it against the XML 1.0 specification using the browser's built-in DOMParser. Unlike regex-based prettifiers that break on CDATA sections, processing instructions, or namespace prefixes, the parser constructs a real DOM tree and re-serializes it, so every XML construct — namespaces, attributes, comments, CDATA, entities — is handled correctly.
Error reporting points to the exact position where well-formedness breaks: unclosed tags, mismatched tags, duplicate attributes, and illegal entity references all surface with a line and column. The formatter does not validate against an XSD schema (that is a separate, heavier step); it checks well-formedness, which is what you need 90% of the time when an XML feed fails to parse.
Indentation is configurable (2 or 4 spaces, or tabs), and you can choose to preserve or normalize whitespace-only text nodes, which matters for mixed-content XML like XHTML where whitespace between elements is significant. Everything runs locally — useful for config files, SOAP envelopes, and internal API responses you should not paste into an online formatter.
How to use it
- 1Paste XML into the editor, or drag a .xml / .svg / .rss / .xsd file onto the drop zone.
- 2Pick indentation: 2 spaces, 4 spaces, or tabs.
- 3Choose whether to collapse or preserve whitespace-only text nodes.
- 4If the parser reports a well-formedness error, jump to the flagged line and fix the token.
- 5Click Copy or Download to export the formatted XML.
When to use it
- ✓Pretty-printing a one-line RSS feed so you can find the right entry.
- ✓Formatting a Spring beans.xml or pom.xml that a merge conflict left unreadable.
- ✓Diagnosing why a SOAP response fails to parse in the client library.
- ✓Tidying an SVG hand-edited in a text editor before importing into a design tool.
Features
- •Real DOM-based parse and re-serialize — handles CDATA, namespaces, and processing instructions.
- •Line/column-precise well-formedness error reporting.
- •Configurable indent and whitespace-only text node handling.
- •100% client-side — safe for internal config and API responses.
Related tools
XML to JSON
Convert XML data to JSON format. Free online tool — runs in your browser, no sign-up required.
JSON to XML
Convert JSON data to XML format. Free online tool — runs in your browser, no sign-up required.
JSON Formatter & Validator
Paste and check JSON syntax, then indent it, sort object keys, or minify the output for copying or download.
YAML Validator
Validate and format YAML data. Free online tool — runs in your browser, no sign-up required.
SQL Formatter
Format and beautify SQL queries. Free online tool — runs in your browser, no sign-up required.
JSON to Excel
Convert JSON data to Excel format. Free online tool — runs in your browser, no sign-up required.
CSV Merge
Combine multiple CSV files into one. Free online tool — runs in your browser, no sign-up required.
CSV Remove Duplicates
Remove duplicate rows from CSV files. Free online tool — runs in your browser, no sign-up required.
FAQ
Does it validate against an XSD schema?
No. This tool checks XML well-formedness (parseable per the XML 1.0 spec) but does not validate against a schema. XSD validation is a heavier step that this tool does not perform; use a dedicated schema validator for that.
Will formatting change my XML semantically?
For data-style XML, no. For mixed-content XML like XHTML, whitespace between elements can be significant — toggle 'preserve whitespace text nodes' to keep the original spacing intact.
Is my XML uploaded anywhere?
No. Parsing and formatting run entirely in your browser via DOMParser. Nothing crosses the network, so it is safe for internal config and API responses.
Why does my self-closing tag become <tag/> after formatting?
That is the canonical XML serialization for an empty element. <tag></tag> and <tag/> are semantically identical, and the serializer picks the shorter self-closing form.
Does it handle XML with namespaces and prefixes?
Yes. The DOM parser natively understands namespace declarations (xmlns) and prefixes. Formatting preserves all namespace bindings and does not mangle prefixed element or attribute names.
What is the largest file I can format?
Around 10 MB works smoothly. Beyond that, DOMParser builds a full in-memory tree which can strain the browser; for very large XML, use a streaming SAX parser server-side instead.