About XML Formatter
Pretty-print, minify, and validate XML in your browser. We run a DOMParser well-formedness check before formatting so you see a precise parse error rather than garbled output. Handles namespaces, CDATA sections, processing instructions, and comments cleanly. Pick indent width — 2, 4, or tab.
What XML formatting touches
XML’s well-formedness rules are stricter than HTML’s. Every tag must close, attributes must be quoted, ampersands must be escaped. A formatter has to honor these rules — but more importantly, it has to refuse output if the input is not well-formed. Garbage in, error out, never garbage in, garbage out.
We use the browser’s built-in DOMParser to validate. If it parses, we format from the parsed tree. If it does not, you see the exact line and message before any formatting attempt.
Common XML you actually format
- RSS / Atom feeds — debugging a feed reader
- Sitemaps — verifying a generator’s output
- SVG — inspecting a designer’s export
- SOAP envelopes — reading a legacy API response
- POM (Maven) / Gradle — diffing build configs
- Android resources —
strings.xml,colors.xml - OPML — exporting / importing podcast subscriptions
- WSDL / XSD — comprehending vintage SOAP services
The format dropped from “default” to “specialized” over the past decade, but the volume of XML in the wild is enormous and growing slowly.
Common workflows
Debug a malformed feed. Paste the feed XML, see the precise parse error, fix the source.
Compare two XML configs. Format both, drop into the Diff Checker. Whitespace differences vanish; structural drift surfaces.
Audit an SVG export. Format makes the structure readable. Then run SVG Optimizer to strip the editor metadata.
Inspect a SOAP envelope. Most SOAP responses arrive flattened. Format, find the actual payload, ignore the envelope ceremony.
Why a separate tool from HTML
HTML’s parser is forgiving (quirks mode, error recovery, implied tags). XML’s parser is not. Using an HTML parser on XML gives wrong results — implicit tags get added, void elements behave differently, attributes lose their case. The XML-specific tool runs the right parser by default and tells you immediately when input is invalid.
Frequently asked questions
Why does my XML show "no element found"?
Are CDATA sections preserved?
<![CDATA[...]]> contents pass through byte-identical. Useful for embedded HTML or SQL.How does it handle namespaces?
Is XML still relevant?
Can I format SVG with this?
What is XPath in this context?
Related tools
Last updated: 2025-01-15