XML Formatter
Format, minify, and validate XML
Input
Output
An XML formatter and validator built on the browser's own DOMParser — paste XML to get a clearly indented, readable version, or switch to Minify for the smallest valid form. Malformed XML gets a clear, specific error message instead of silently mangled output.
- Is my XML sent anywhere?
- No. Parsing, validation, and formatting all happen locally in your browser using the built-in DOMParser — nothing is sent to a server.
- What counts as "invalid" XML here?
- Anything that isn't well-formed — unclosed tags, mismatched tags, invalid characters, or a bare "&" that isn't part of a valid entity reference. The error message comes directly from the browser's own XML parser, the same one it uses to load real XML documents.
- Are comments and CDATA sections preserved?
- Yes — comments, CDATA sections, processing instructions, and the XML declaration (if present) are all preserved exactly through formatting and minifying.
- How does Minify differ from Format?
- Format re-indents the document with two-space indentation for readability. Minify strips all insignificant whitespace between tags to produce the smallest valid representation of the same document.