XML Formatter & Validator
Paste XML below to pretty-print, validate, or minify it. Runs entirely in your browser — nothing is uploaded.
Last updated
About this tool
This formatter parses your XML with the browser's native DOMParser, so a malformed document — an unclosed tag, a mismatched end tag, an unescaped & — is caught the same way it would be by any standard XML parser, with the browser's own error description shown below the input. Formatting uses 2-space indentation and preserves attribute order, comments, CDATA sections, and a leading <?xml ?> declaration or <!DOCTYPE> if present; minify strips insignificant whitespace between tags to produce a single compact line.
Whitespace-only text between elements is not treated as significant, so formatting will collapse indentation-only whitespace in the source — this is safe for typical data and config XML, but not appropriate for XML where whitespace inside elements is meaningful (like <pre>-style content). External DTD and entity references are never fetched or resolved. Nothing you paste here is sent to a server — the entire tool runs as JavaScript in your browser tab.