XML Formatter & Minifier
Pretty-print or minify XML, with validation and configurable indent width.
Quick answer: XML Formatter & Minifier: pretty-print or minify XML, with validation and configurable indent width. Runs entirely in your browser, free, no signup.
Last updated
Good to know
Because this formatter uses the browser's own DOMParser, it validates well-formedness — balanced tags, quoted attributes, legal characters — the same way your app's XML parser will. That makes it a fast sanity check before you ship a config, a sitemap, or a SOAP request: if it won't format, it won't parse in production either.
It does not validate against a schema, though. An XSD or DTD defines which elements are allowed where and what types their values must be; checking that requires a much heavier validator. So a document can format perfectly here yet still be rejected by a strict service that enforces a schema. Use this for structure and readability, and a dedicated schema validator for contract compliance.
The minify mode strips the whitespace between tags, which is exactly what you want for RSS feeds, SVG assets, or SOAP payloads where every byte counts on the wire. Be careful with elements whose whitespace is significant — <pre>-style content or anything marked xml:space="preserve" — since DOMParser normalizes text-node whitespace per the spec. Wrap literal content in CDATA when you need it kept verbatim.
Namespaces, the XML declaration, and CDATA sections are preserved, so SVG and SOAP round-trip safely. If you actually need to move the data into JSON or YAML rather than just pretty-print it, reach for the JSON ↔ XML converter instead.
Frequently asked questions
- Will it validate against an XML schema (XSD)?
- No — only well-formedness (correct tags, balanced quotes, valid characters). XSD validation needs a much larger library; use a desktop tool for that.
- Is this safe for SOAP / RSS / SVG?
- Yes — all three are valid XML. The formatter preserves namespaces, CDATA sections and the XML declaration.
- Will my XML be uploaded?
- No — DOMParser runs in the browser. Nothing leaves your device.
- Why does the output sometimes wrap differently than expected?
- DOMParser normalises whitespace inside text nodes per the XML spec. Use a CDATA section or change <code>xml:space="preserve"</code> if you need exact whitespace fidelity.
- Can I minify a large XML file?
- Yes — files up to several megabytes minify instantly. Larger files (50 MB+) may approach browser memory limits.