XML Formatter & Validator

100% Client-Side
Privacy: 100% Client-Side. Your data never leaves this browser tab. Processing uses Web APIs and client-side libraries only.

Check XML is well-formed (XML 1.0 and namespaces) with line and column errors, then pretty-print or minify it without touching text, CDATA or comments.

✓ Well-formed XML 1.0 with valid namespaces.

<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns:dc="http://purl.org/dc/elements/1.1/">
  <!-- sample -->
  <book id="b1" available="true">
    <dc:title>XML &amp; You</dc:title>
    <price currency="EUR">12.50</price>
    <note>Kept <em>exactly</em> as written</note>
  </book>
  <book id="b2"/>
</catalog>

Only whitespace between elements is changed. Text, mixed content, CDATA, comments, entities and xml:space="preserve" are kept exactly. Well-formedness is checked; validation against a DTD or schema is not.

What does the XML formatter do?

It checks that a document is well-formed XML: one root element, matching tags, quoted and unique attributes, valid names, character and entity references, comments, CDATA and the XML declaration, plus Namespaces in XML (every prefix declared, at most one colon per name). Errors point to the exact line and column.

It then re-indents only element-only content. Text, mixed content, CDATA, comments, entity references and anything under xml:space="preserve" stay byte for byte, the way xmllint --format behaves, so formatting never changes the data.

How to use this tool

  1. Paste XML into the input. It is checked as you type.
  2. Pick an indent and copy the pretty-printed or minified result, or use Prettify / Minify to rewrite the input.
  3. Click Show in input on an error to jump to the problem.

Frequently asked questions

Does it validate against a schema or DTD?

No. It checks well-formedness and namespaces, which every XML parser requires. Validation against an XSD or DTD is a separate step.

Is it safe to format signed XML such as SAML?

Formatting only changes whitespace between elements, but XML signatures cover exact bytes after canonicalization, and some canonical forms keep that whitespace. Verify signatures on the original document, not a formatted copy.

Is my XML uploaded?

No. Parsing and formatting run entirely in your browser.