Pretty-print and validate XML

Indent a messy XML document and surface well-formedness errors before it reaches a parser.

By The DevFixPro Editorial Team · independent editorial research project

Private by design. Every tool linked below runs 100% in your browser — your code, text, and tokens never leave your device.

The XML will not parse and the error is unhelpful

A missing closing tag, a misplaced attribute, or a stray character in a config or feed can break an entire import with a message that points nowhere useful. Pretty-printing the document is often the fastest way to spot the structural problem by eye.

Format and validate

The XML Formatter indents your document for readability and checks well-formedness, flagging where the structure breaks. Paste the raw XML, get a clean tree, and fix the offending node before it hits a strict parser.

When the data is JSON instead

Many APIs speak JSON rather than XML. If that is your case, the JSON Formatter & Validator does the same job for JSON — pretty-print plus validation — so you are covered whichever format arrives.

Typical scenarios

  • Debugging a SOAP response or an RSS/Atom feed.
  • Cleaning up a hand-edited configuration file.
  • Confirming a document is well-formed before a batch import.

Frequently Asked Questions

What is the difference between well-formed and valid XML?

Well-formed means the syntax parses: tags balance, attributes are quoted, and there is one root. Valid is stricter and means the document also matches a schema. A formatter checks only the first.

Will reformatting change what a document means?

Not for element-only content, because whitespace between tags is insignificant there. Mixed content that puts text and elements side by side is the case to watch, since some whitespace can be significant.

The parser reports a line and column but no reason. Where do I look?

Start at exactly that position. The usual causes are a closing tag that names a different element, an attribute value missing a quote, and an ampersand that should have been escaped as an entity.

← All guides

Related tools from our network

A focused set of free calculators and guides across related topics — no account required.