Free XML Formatter & Validator

Paste your XML below to format it with proper indentation and validate its syntax. Errors are reported with exact line references. Configurable indent size.

🔒 100% Private ⚡ Instant 🆓 Free
Advertisement

About the XML Formatter

This free XML formatter and validator uses the browser's native DOMParser to parse your XML and then serialises it back with consistent indentation. Parsing errors — like unclosed tags, mismatched elements, or invalid characters — are reported with the error message from the parser.

Use it to format SOAP envelopes, RSS/Atom feeds, Android resource files, Maven pom.xml, configuration files, and any other XML document.

How to Format XML

1

Paste Your XML

Copy any XML document or snippet and paste it into the input area.

2

Set Indent

Choose 2 spaces, 4 spaces or tabs to match your project style.

3

Format & Validate

Click "Format XML". Valid XML is formatted; invalid XML shows an error message.

4

Copy

Copy the formatted XML to clipboard for use in your project.

Frequently Asked Questions

Yes. It uses DOMParser with "text/xml" MIME type, which strictly validates well-formedness. Errors like unclosed tags or malformed attributes are reported immediately.

No. Schema validation (XSD, DTD, RelaxNG) requires a server-side validator. This tool checks XML well-formedness only — that tags are properly nested and closed.

Yes. Namespace prefixes and URI declarations (xmlns attributes) are preserved in the formatted output.

Only XHTML (which is valid XML) can be formatted here. Standard HTML5 is not XML and will likely fail validation. Use the HTML Formatter for HTML5 documents.

Related Developer Tools