XML Formatter
Pretty-print, minify, and validate XML with syntax highlighting.
How to Use
- Paste XML content into the input area.
- Pick the indent width (2, 4 spaces, or tab).
- Click Pretty to format with proper indentation, or Minify to strip whitespace.
- The browser's native XML parser validates as you go — errors show line and column.
- CDATA sections are preserved verbatim (their content is never reformatted).
- Copy the formatted output with the copy button.
Paste XML.
Notes
About the XML Formatter
Need a hand with image, audio and file tasks? The XML Formatter does the work for you — free, and right here in your browser. Pretty-print, minify, and validate XML with syntax highlighting.
How it works
Enter what you have and read the result as it updates live. It all runs on your own device, so it is quick and private, with nothing to install.
Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.
Frequently Asked Questions
Will this format HTML?
Strict XML formatting will reject most HTML because HTML is not well-formed XML (unclosed tags, attributes without quotes, etc.). For HTML, use the dedicated HTML formatter or the Minifier/Beautifier with HTML mode. XHTML (XML-compliant HTML) works here.
What's the difference between XML and HTML?
<strong>XML</strong> requires every tag to be closed (or self-closing), every attribute quoted, case-sensitive tag names, and one root element. <strong>HTML</strong> is much more forgiving — many tags are optional, attributes can be unquoted, case-insensitive. XML is for data interchange (configuration, RSS, SOAP, SVG); HTML is for presentation.
How does CDATA work?
<code><![CDATA[ ... ]]></code> wraps content that should not be parsed as XML — useful for embedding code, scripts, or text that contains <code><</code> or <code>&</code>. The formatter preserves CDATA blocks intact, since reformatting them might break embedded content. Common in RSS, Atom feeds, and legacy SOAP APIs.
What about XML namespaces?
Preserved correctly. Namespace declarations (xmlns:prefix='URI') and prefixed elements are kept intact. The formatter doesn't try to optimize namespace usage; if your input declares 5 namespaces and uses 2, the output keeps all 5 declarations.
Will it validate against a DTD or XSD?
No — it only checks well-formedness (proper nesting, closed tags, valid XML syntax). For schema validation against a DTD or XSD, use a dedicated validator like xmllint, an online schema validator, or a desktop tool with XSD support. Browser native XML parsers don't do schema validation.
Is XML still relevant?
For new development, JSON has largely replaced XML for web APIs and most config formats. XML persists in: SOAP web services (banking, healthcare, government APIs), RSS/Atom feeds, Microsoft Office documents (.docx is XML inside), Java configuration (.xml in many frameworks), SVG vector graphics, and legacy enterprise integration. Knowing XML formatting still matters.
How do I use the XML Formatter?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Is it free? Does it work without internet?
Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.
Where does my data go?
Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.
Common Use Cases
SOAP API debugging
Format SOAP request and response payloads to understand what's being sent and received.
RSS / Atom feed inspection
Examine podcast or blog feeds for structure issues.
Configuration file editing
Format Spring, Maven (pom.xml), or other Java project files for readability.
Office document inspection
Unzip a .docx or .xlsx and format the embedded XML to understand the document structure.
SVG editing
SVG is XML — format hand-written or generated SVG for clean structure.
Sitemap audit
Format and validate XML sitemaps for SEO before submitting to search engines.
Last updated: