📄

XML Formatter & Validator

Beautify, minify or validate XML with safe mixed-content handling, configurable whitespace controls and detailed document statistics.

DOM validatedPrivate in browserSafe formatting

XML input

0 characters

Processed XML

Valid XML output after the selected operation
Your formatted or minified XML will appear here.
0 elements0 attributesDepth 00 bytes
🧩

Mixed content protection

Elements containing both text and child elements are kept compact so formatting does not insert meaningful whitespace into prose-oriented XML.

Well-formedness validation

The formatter checks closing tags, attribute syntax, entity references and document structure. This is syntax validation, not XSD or DTD schema validation.

🔐

Local processing

Your XML and uploaded files are processed in the browser. No document content is uploaded by the formatter.

Format XML without changing its meaning

Whitespace between elements is often only indentation, but whitespace inside text and mixed-content documents can be meaningful. This formatter removes indentation-only nodes where safe and preserves compact serialization around mixed text.

Why is one element not expanded across multiple lines?

It likely contains mixed content—both text and child elements. Adding indentation there could change the text value, so the element is deliberately kept compact.

Does “valid XML” mean it matches my schema?

No. It means the document is well formed. Business rules, allowed elements and data types require validation against an XSD, DTD, Relax NG schema or application-specific rules.

What does minification remove?

It removes indentation-only whitespace and optionally comments. It preserves text, CDATA content, processing instructions, namespaces and the parsed document structure.

Can formatting change signed XML?

Yes. Cryptographic XML signatures and canonicalized documents are byte-sensitive. Do not format or minify signed XML unless you understand the signature and canonicalization workflow.