XML Formatter & Validator

Pretty-print, validate and minify XML online. Shows well-formedness errors with line numbers and preserves comments, CDATA and declarations.

Runs 100% in your browser. Nothing you paste is uploaded.

Input

Output

—

About the XML Formatter

Paste any XML document — SOAP envelopes, Maven pom.xml, Spring configs, Android layouts, RSS/Atom feeds or SVG — and get it back properly indented and syntax-highlighted. The formatter checks that the document is well-formed using the browser’s native XML parser and reports the line of the first error.

Comments, CDATA sections, processing instructions and the XML declaration are preserved exactly; only whitespace between tags is changed.

Features

  • Well-formedness validation with line numbers
  • Configurable indentation (2/4 spaces or tabs)
  • Minify XML by removing insignificant whitespace
  • Preserves comments, CDATA, PIs and DOCTYPE
  • Keeps short text content inline: <a>text</a>
  • Syntax highlighting for tags, attributes and values

How to use it

  1. Paste XML or upload a file into the input pane.
  2. Pick the indentation; the formatted output appears instantly.
  3. Fix any reported well-formedness error, then copy or download the result.

Frequently asked questions

Does the formatter validate against an XSD schema?

No — it checks that the XML is well-formed (correct nesting, quoting and escaping). Schema validation requires the XSD and is not performed.

Will formatting change my data?

Only whitespace between elements is changed. Text nodes that contain non-whitespace characters, attributes, comments and CDATA are kept verbatim.

Can I format HTML with this tool?

Only XHTML. For regular HTML, which allows unclosed tags, use the HTML Formatter.

Esc