Skip to content
MyDailyTool

XML Formatter

Format, indent, and validate XML documents. Detects malformed tags, unclosed elements, and bad attributes with clear line-level error messages. Great for config and API work.

How to use the xml formatter

Paste XML into the input box and press Format to pretty-print and validate. Errors point to the first parse failure.

Formula & explanation

Validation: DOMParser. Pretty-print: insert newlines and 2-space indent at each tag boundary, preserving text content.

Examples

<root><a>1</a></root> formats with each tag on its own line.

Frequently asked questions

What XML dialects does this support?
Any well-formed XML — RSS, SVG, XHTML, SOAP, and custom schemas all work as long as the syntax is valid.
Why does the formatter show an error on my file?
XML is strict: every tag must be closed, attribute values must be quoted, and special characters like & must be escaped as &amp;. The error message points to the first violation.
Does this validate against a schema (XSD/DTD)?
No — it checks well-formedness only, not schema validity. For full XSD validation you need a server-side tool.
Is my XML sent to a server?
No. Parsing and formatting happen entirely in your browser using the built-in DOMParser API.

Related developer tools tools