XML Formatter
Pretty-print XML and catch malformed tags before they reach production.
How XML Formatter works
Format and validate XML with clear parse errors, using two-space, four-space or tab indentation. Everything happens inside this page: the tool reads your input, runs the calculation or conversion locally, and hands the result back to you. Nothing is transmitted, because there is no backend to transmit it to.
That design choice is deliberate. Most free tool sites upload your files to a server, process them there, and quietly keep a copy. Toolcin cannot do that — the site is a set of static files. If your connection dropped the moment the page finished loading, every tool would still work.
Parse first, then indent
The text is parsed by the browser's own XML parser before anything is printed, so malformed markup fails with a parser error instead of producing a prettified but broken document. That is the difference between a formatter and a text-regex toy.
Indentation is applied to elements and preserved inside text nodes, so a CDATA block or a long attribute value is not silently rewrapped.
Things that break XML that look fine
Unescaped ampersands, unclosed tags, a second root element and mismatched case in tags are the four failures people hit constantly. XML is case-sensitive, so <Item> and </item> are different tags as far as the parser is concerned.
A DOCTYPE pointing at an external DTD may be ignored or rejected depending on the parser. If a document fails here but opens in an editor, the editor is probably resolving the DTD; the markup itself may still be invalid.
| Symptom | Usual cause |
|---|---|
| “Invalid XML” at line 1 | Unescaped & or a stray < |
| “Extra content at the end” | Two root elements |
| “Mismatched tag” | Case difference or an unclosed element |
| Nothing happens | Empty input — there is nothing to format |
Formatting is not validation
A document can be perfectly well-formed and still be wrong for its schema — the right tags in the wrong order, a missing required element, an attribute that should not be there. This tool checks syntax only.
For schema validation you need the XSD and a validator; formatting a file that fails schema validation just makes the failure easier to read.
Good to know
- Works offline once loaded, including on flights and in locked-down networks.
- No file size limit beyond your device's own memory.
- Free to use, with no account and no usage counter.
- Results are produced locally, so they are not logged or shared with anyone.
Questions
What happens with invalid XML?
The parser reports the error instead of producing broken output.
Are attributes preserved?
Yes, verbatim and in their original order.
Does it preserve comments?
Yes, comments are kept in place, since they are part of the document.
Can it minify XML?
Not in this version — the output is always indented.
Keep going
More files tools
JSON to YAML
Convert JSON into clean YAML with correct quoting, nesting and indentation.
Open toolMarkdown to HTML
Convert Markdown headings, emphasis, links, lists and blockquotes into clean HTML.
Open toolJSON to XML
Convert a JSON object into well-formed XML with nested elements and escaped values.
Open toolXML to JSON
Convert XML documents into JSON objects, with repeated tags turned into arrays.
Open toolYAML to JSON
Convert YAML configuration into JSON, handling nesting, lists and scalar types.
Open toolCSV to TSV
Convert comma-separated data into tab-separated values for spreadsheets and databases.
Open tool