XML Formatter
Validate XML and indent its element structure.
Processed on your device. Your files and text are not uploaded.
Validates XML; mixed-content elements are kept together. Do not use reformatting for digitally signed XML.
How to use
Paste your input, choose an operation, then copy or download the result.
Practical workflow
Inspect XML without losing the original
- 1Paste a small XML document and keep the source file unchanged.
- 2Format it to check nesting. If parsing fails, check closing tags and escape literal ampersands as &.
- 3Compare text, attributes and namespaces before copying or downloading.
Before you use the result
A successful parse checks XML syntax, not an XSD schema or your application rules. Reformatting can invalidate a digital signature; never replace signed XML with formatted output.
XML example and common parsing problems
<items><item code="0012">Notebook & pen</item></items> Expected: one items element containing one item; code stays 0012 and the text represents Notebook & pen.
Common questions and fixes
Why is my ampersand rejected?
Use & for a literal ampersand in XML text. An unescaped & starts an entity reference; replacing every ampersand blindly can double-escape existing entities.
Does valid XML mean the document matches my schema?
No. This tool parses and formats XML but does not validate an XSD, fetch a DTD or verify business rules. Check those separately in the receiving system.
Can formatting change spaces?
The formatter keeps mixed-content elements together, but serialization can still change the byte representation. Retain the source when whitespace or digital signatures matter.
When to use XML Formatter
Validate an XML document and indent nested elements for inspection. Mixed-content elements stay together to avoid changing meaningful spaces within text.
Practical example
<items><item>Notebook</item></items> becomes an items element containing an indented item. A mismatched closing tag is rejected.
Can I use the output for signed XML?
Do not reformat digitally signed XML. Serialization can change a document’s byte representation and invalidate its signature. XML declarations and namespace serialization may differ from the original.