Developer Tools

XML Formatter

Nested XML is difficult to scan when it arrives on a single line. This formatter checks basic well-formedness and lays out elements using your chosen indentation. It keeps XML as text throughout the operation: no document is mounted into the page, no stylesheet is applied, and no external entity is retrieved. Use the output for inspection and code review. Formatting is not XML schema validation, canonicalization or a guarantee that a downstream application will accept the document.

Your workspace

Runs locally in your browser

Result

Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.

How to use this tool

Paste XML without a DTD, choose indentation, and format. Review any reported line error before copying.

Example

Input

<root><item id="1">Hello</item></root>

Output

<root>
  <item id="1">Hello</item>
</root>

What does this tool do?

XML elements need matching case-sensitive opening and closing names. Attribute values need quotes, and literal ampersands usually need an entity escape such as &amp;. One root element encloses the document. A parser error near the end of a file can be caused by a missing close tag much earlier, so check the surrounding parent structure before changing the reported line.

Common mistakes and limitations

DTD and entity declarations are rejected, including otherwise legitimate documents that use them. Namespaces are not checked against an XSD. Mixed text and element content can be whitespace-sensitive; compare the result before using it in a signed document, an XML-based layout or a text-processing pipeline. CDATA is text content, not an instruction to execute embedded code.

Frequently asked questions

Does this validate an XSD?

No. It checks basic XML syntax but does not fetch or apply schemas.

Related tools