Pretty-print, minify and basic syntax check for XML; auto-indent and attribute alignment.

Switch tool
Input0 chars · 0 lines
Output0 chars · 0 lines

How to use

Purpose

Online XML formatter and beautifier that pretty-prints XML with proper indentation, preserves CDATA and comments, keeps namespace prefixes intact. Handles SOAP envelopes, Maven pom.xml, Spring config, AndroidManifest, SVG, and other XML dialects. Minify mode strips whitespace for transport or string embedding. Detects unclosed tags, missing attribute quotes, and namespace issues during editing. All processing happens locally in the browser; nothing is uploaded.

Steps

  1. Paste XML into the editor or drop a .xml / .pom / .svg / .config file
  2. Click Format for 2-space indented output with nested tags clearly visible and attributes aligned
  3. Click Minify to strip whitespace and newlines for transport or string embedding
  4. Structure issues (unclosed tags, missing quotes, invalid characters) are flagged inline
  5. CDATA sections, comments, and processing instructions (<?xml ?>) are preserved verbatim
  6. Convert to JSON via the cross-tool jump to xml-json-converter
  7. Export as .xml or copy the formatted string

FAQ

Why do namespace prefixes disappear after formatting?
The tool preserves all xmlns declarations and prefixes (soap:Envelope, xsi:schemaLocation). If a prefix is missing, the source document likely never declared it. SOAP, SAML, and WSDL with deep namespace nesting all format correctly.
Are special characters inside CDATA escaped?
No. CDATA sections (<![CDATA[ ... ]]>) keep their content as-is — HTML entities are not escaped, newlines stay. Important for embedded SQL, JavaScript, or rich text.
Why does my XML report "Premature end of file"?
Usually unclosed root tag or truncated content. XML requires exactly one root element and every tag strictly closed. Check for BOM at the start, truncation at the end, or HTML-style self-closing tags (<br> must be <br /> in XML).
Can I format Maven pom.xml or Gradle settings.xml?
Fully supported. pom.xml with deep dependencies and multi-profile setups becomes much more readable than IDE folding. Gradle and Ant build files too.
What is the difference between XML and HTML formatting?
XML is strict (every tag closed, case-sensitive, attributes quoted). HTML is forgiving. For HTML use html-css-formatter which handles void elements (<br>, <img>, <input>) per HTML5 spec.

Use cases

  • Debug SOAP APIs: format envelopes captured from Wireshark or proxy to see Header/Body structure
  • Audit Maven pom.xml: deep dependency trees and multi-profile configs are far clearer after formatting
  • Edit AndroidManifest: activity, intent-filter, and permission nesting becomes obvious
  • Read SVG source: exported SVG from Figma is single-line; format to tune paths manually
  • Maintain Spring XML config: legacy applicationContext.xml with bean references reads better when formatted

Use cases

Debug SOAP envelopes, read Maven pom.xml, edit AndroidManifest, polish SVG, maintain legacy Spring config. Backend, Android, designers manually editing SVG, and DevOps maintaining legacy systems all use this. Namespace preservation, CDATA safety, and precise error reporting are the differentiators.