Skip to content

File Tools

XML Formatter & Validator

Pretty-print and minify XML documents with clear indentation and instant parsererror line/column syntax diagnostics.

Input XML224 characters
Formatted / Minified Output0 characters

Well-Formed Is Not Valid

A formatter can only verify that XML is well-formed: one root element, every tag closed, attributes quoted, entities escaped. It cannot check that the document obeys its schema — that an order element contains a date, or that an id attribute is unique. The other formatting decision that matters is whitespace significance: pretty-printing element content adds indentation characters inside mixed-content elements, which changes string values in data-centric XML. Format documents for reading; keep data files minified.

Well-Formed Is Not the Same as Valid

An XML parser checks that a document is well-formed: one root element, every tag closed and properly nested, attribute values quoted, and special characters such as & and < escaped. Those are the errors reported here with a line and column. Passing the check does not mean the data matches a schema; that requires validating against an XSD or DTD.

Formatting only adds whitespace between elements, which is harmless in data files but can matter in mixed content, where spaces between inline tags are part of the text. Minify before sending a payload and pretty-print only for reading or diffs.

How the Tool Processes Your File

  1. Paste your XML document into the editor, including the declaration if present.
  2. Choose Format to indent the tree, or Minify to produce a compact single-line version.
  3. The built-in XML parser reports a parsererror with exact line and column numbers when the document is malformed.
  4. Copy the result or download it as a .xml file.

Typical Use

Pretty-print a minified feed
Input: <feed><entry><title>A</title><id>1</id></entry></feed>
Output: Indented tree with one element per line
Formatted XML is far easier to audit manually — essential when reviewing configuration files or API payloads.
Find an unclosed tag
Input: <config><enabled>true</config>
Output: parsererror: mismatched tag at line 1, column 29
Standard XML parsers do not tolerate unclosed tags. The precise line and column lets you fix the source immediately.

Common Questions

Does the validator catch all errors?

It catches well-formedness errors (structure, tags, escaping). Schema validation against XSD or DTD is not performed — that is a separate step.

Is CDATA preserved?

Yes. CDATA sections are recognized and preserved verbatim in both formatted and minified output.

Can I handle large documents?

Yes, parsing happens in-browser. Files in the low-megabyte range format instantly; multi-megabyte documents remain responsive on modern hardware.