Beautify and validate XML code online.
XML is a markup language used to organize structured data. XML documents contain elements, attributes and text that applications can read and process.
This tool checks whether XML is well-formed and offers conservative formatting for simple element-only documents.
The Clear button removes the current input. Editing the XML also clears an earlier validation message.
<root><one/><two/></root>
<root>
<one/>
<two/>
</root>
For a simple document containing adjacent element tags, the formatter can insert line breaks and two-space indentation to improve readability.
The formatted output should still be reviewed before use. Adding indentation also introduces whitespace between elements, which some applications may interpret as text.
Readable formatting must not come at the cost of silently changing important data.
This tool deliberately skips formatting when it detects existing text nodes, including whitespace-only text nodes. It also skips documents containing special XML nodes.
<p>Hello <b>world</b>!</p>
The spaces around the nested bold element are meaningful. The formatter therefore leaves this input unchanged.
<root><![CDATA[A > < B]]></root>
A CDATA section can contain characters that would otherwise need escaping. The formatter does not rewrite documents containing CDATA.
XML comments and processing instructions may contain characters and spacing that should remain untouched. Documents containing these nodes are left unchanged by the formatter.
The formatter avoids rewriting documents with existing whitespace text nodes. It also skips formatting when an XML declaration, DOCTYPE or an xml:space attribute is present.
This is an intentionally conservative approach, not an advanced automatic pretty-printing system for every possible XML document.
XML syntax validation checks whether the document is well-formed. For example, element tags must be properly nested and attributes must follow XML syntax rules.
XSD schema validation is different. It checks whether a document follows an expected structure, including specified elements, attributes and data types.
This tool checks XML well-formedness. It does not validate documents against an XSD schema.
XML namespaces help distinguish elements with similar names. The browser's XML parser is used to check the input, including namespace-related syntax.
For simple documents that can be formatted, the formatter retains the original element names, namespace prefixes and attribute text.
It does not rename namespace prefixes or reorder attributes. Formatting can add whitespace text nodes between otherwise adjacent elements.
This is a lightweight XML formatting and syntax-checking tool. It does not repair invalid XML, perform XSD validation or guarantee that added whitespace is harmless for every XML-consuming application.
Some valid documents are intentionally left unchanged to protect their existing content.
Always retain the original XML and test formatted output in the application that will consume it.
XML validation and formatting use JavaScript and the browser's XML parser. The tool does not submit your XML text to an external formatting API.
Selecting Copy sends the current XML text to your device's clipboard. Clipboard permissions and storage depend on the browser and operating system.
Yes. The XML formatting and syntax validation functions are free to use.
No. Invalid XML is reported, but the tool does not automatically repair malformed documents.
The formatter may leave the input unchanged to protect text, whitespace, comments, CDATA or other sensitive XML content.
The browser's XML parser checks namespace-related syntax. The formatter does not modify namespace prefixes.
No. This tool checks XML syntax but does not perform XSD schema validation.
Not necessarily. Indentation adds whitespace between elements. Avoid formatting when extra whitespace could affect the application reading the document.
The formatting and validation functions run in your browser without submitting the text to an external XML processing API.