About XML Formatter
FreeToolr XML Formatter helps developers, testers, students, and technical writers make XML easier to read or smaller to share. Paste XML into the tool, choose beautify or minify, and review the result in your browser. If the document is not well formed, the tool reports its first error. Nothing is uploaded, and nothing needs installing. Use it for API responses, configuration files, feeds, SVG files, SOAP messages, or other XML documents. The tool keeps the main task in one place: format XML, minify XML, or find the first syntax problem. It does not claim to validate an XML document against an XSD or DTD schema. XML formatting rules come from your chosen output method, while XML syntax follows the W3C XML standard.
How to use it
- 1Paste your XML into the input area.
- 2Choose the beautify or minify option.
- 3Process the XML in your browser.
- 4Copy the formatted result or review the first reported error.
Worked example
Input: <person><name>Ada</name><age>36</age></person> Beautified result: <person> <name>Ada</name> <age>36</age> </person> Minified result: <person><name>Ada</name><age>36</age></person>
How it works
1Parse the input as an XML document.
2Confirm XML 1.0 well-formedness:
exactly one root element;
properly nested elements;
matching start and end tags;
unique attributes per element;
legal entity and character references;
valid XML characters and syntax.
3Serialize the parsed node tree.
4For element-only content, insert:
newline plus indentation times depth before child elements;
newline plus indentation times parent depth before the closing tag.
5Keep text-only elements inline where appropriate.
6Preserve comments, CDATA, processing instructions, namespace declarations, and attribute values unless the user explicitly chooses otherwise.
7Do not alter whitespace inside text nodes, CDATA, or attribute valuesSource: W3C XML 1.0, Fifth EditionWHATWG Dynamic Markup Insertion. Last checked 4 November 2026.
What it is good for
- Format XML without installing software.
- Minify XML in the same browser tool.
- See the first error when XML is not well formed.
- The tool checks XML well-formedness, not XSD or DTD schema validity.
- Whitespace can matter inside XML text content, so review minified output before using it.
Questions people ask
What does an XML formatter do?
It adds readable indentation and line breaks to XML, or removes formatting whitespace for a compact result. FreeToolr also reports the first error when the XML is not well formed.
Is an XML formatter the same as an XML beautifier?
Usually, yes. XML formatter, XML beautifier, pretty printer, and XML indenter commonly describe the same readable formatting task.
Does FreeToolr validate XSD or DTD schemas?
No. It checks XML 1.0 well-formedness, such as matching tags, valid nesting, and legal syntax. Schema validation requires a separate XSD or DTD validation process.
Why was my XML rejected?
Common causes include an unclosed tag, mismatched nesting, more than one root element, an unescaped ampersand, or an unquoted attribute. The tool reports the first error it finds.
Is my XML uploaded to FreeToolr?
No. The tool processes your XML in the browser, and nothing is uploaded. Avoid pasting sensitive data into any website unless your organization allows it.
Can minifying XML change its meaning?
It can if whitespace inside text or mixed content matters to the application. Review minified output before using it in production or sending it to another system.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.