Format XML and check well-formedness
Paste an XML document, check it with your browser's XML parser, and choose readable two-space indentation or compact output. DTD and entity declarations are rejected.
Processing happens in your browser tab. Your XML and results are not uploaded or included in analytics, and this tool does not save them between visits.
How it works
- Paste one complete XML document within the displayed character limit. Remove DTD or entity declarations before using this tool.
- Choose Format with two spaces or Minify, then select Process XML. Fix any reported syntax or processing-limit error.
- Review the output, especially whitespace-sensitive content. Copy it or download a UTF-8 XML file.
Formatting structural XML
Formatting places structural children on separate lines with two spaces per level. For example, <items><item id="1"/><item id="2"/></items> becomes a readable list of two item elements. Minifying removes whitespace-only text between structural child nodes. Comments and processing instructions remain. This is a parser-based rewrite: quote style, empty-element syntax, namespace declarations and entity spelling may change. It is not a byte-preserving editor or XML canonicalizer.
Whitespace, mixed content and CDATA
Text mixed with markup, such as <p>Hello <b>world</b>!</p>, is serialized without reindenting its subtree. The same applies to subtrees marked xml:space="preserve" and elements containing CDATA. Text-only elements, including whitespace-only values, are kept. In other structural elements, whitespace-only nodes are treated as indentation. XML without a schema cannot prove that whitespace is insignificant; review the result before replacing a whitespace-sensitive document.
Well-formedness is not schema validation
The native browser parser checks XML syntax, including matching tags and quoted attributes. It does not validate XSD, DTD rules, application requirements or document meaning. Error wording and locations vary by browser, so this page reports a consistent syntax error instead of claiming a portable line and column. DTD and entity declarations are rejected before parsing; no external resource is fetched by the formatter. XML is shown as text and is never inserted into the page as active markup.
Small documents and UTF-8 downloads
XML parsing runs only when you select Process XML. Input is limited to 20,000 characters so native parsing stays bounded on phones, with additional node, depth and UTF-8 output limits. The preview shows up to 12,000 characters; Copy and Download XML include the complete result. Downloads use UTF-8, and any XML encoding declaration is updated accordingly. Editing the input or mode clears the previous result.
Frequently asked questions
Does this validate an XML schema?
No. It checks whether the document is well-formed XML. It does not validate XSD schemas, DTD rules or application-specific constraints.
Will minifying remove spaces from text?
Text-only values, mixed content, CDATA and xml:space="preserve" subtrees are retained after native parsing. Whitespace-only nodes between structural children are removed. Review whitespace-sensitive XML before using the output.
Why is my DOCTYPE rejected?
DTD and entity declarations are outside this tool's supported scope. They are rejected before parsing rather than expanded or loaded. Use a dedicated XML application if your workflow requires them.
Can I format SVG with this tool?
You can paste a well-formed SVG document within the limits. It is treated only as XML text: it is not displayed, executed, sanitized or certified safe for embedding elsewhere.
Sources
Last reviewed: November 7, 2026
Related tools
- JSON FormatterFormat or minify JSON and check syntax in your browser. Preserve numeric literals and duplicate keys, then copy or download JSON without uploading your data.
- Text CompareCompare two texts and see every added and removed word or line highlighted. A free, private diff checker that works in your browser, in any language.
- CSV to JSONConvert CSV text to JSON with header and delimiter options. Handle quoted commas and newlines, preserve text values and copy or download the result.