XML Formatter
100% LocalFormat and pretty‑print XML locally.
XML formatter
Format and pretty-print XML using the browser parser and a simple indenter. Runs locally.
Privacy note
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.
How to Use XML Formatter
Paste XML
Paste raw or minified XML into the input editor.
Set Indentation
Choose 2-space, 4-space, or tab indentation from the options.
Format or Minify
Click Format to pretty-print the XML, or Minify to compress it into a single line.
Copy Output
Copy the formatted XML to clipboard or download as a .xml file.
XML Formatter: the essentials
The XML Formatter cleans, validates, and pretty-prints minified XML, SOAP envelopes, RSS feeds, SVG, sitemaps, and enterprise payloads, using the browser's native parser. Indentation, attribute alignment, and structure visualization, all entirely client-side so confidential business data never leaves your machine.
Key points
- Reflows xml formatter into clean, readable output with standard indentation and keyword casing.
- Runs entirely in your browser, so production data never leaves your device.
- Supports multiple dialects and syntax variants for broad compatibility.
What is XML Formatter?
Frequently Asked Questions
Technical Deep Dive
XML Formatter
Paste raw XML and get a clean, indented version using the browser parser and a simple formatter. Useful for logs and API payloads.
xmllint --format is the Unix default. This formatter pretty-prints XML in the tab, including SOAP envelopes you should not upload.
Paste <root><id>1</id></root>. You should get indented tags. A missing closer must show a parse error, not a silent wrap.
It is not an XSD validator. Huge documents can stall the parser. DTDs that fetch network entities are rejected for safety.
01 XML Dialect Matrix
| Dialect | Standard Usage | Hierarchy | Complexity |
|---|---|---|---|
| SOAP | Enterprise Services | Deeply Nested | High |
| SVG | Vector Graphics | Flat to Medium | Medium |
| RSS/Atom | Content Syndication | Fixed Schema | Medium |
| XHTML | Legacy Web | Document-centric | Low |
02 Formatting Workflow
03 Where XML Still Runs the World
JSON took the new APIs, but XML stayed put in enterprise, identity, publishing, and document interchange. These are the places you'll actually paste a 200KB blob into a formatter.
-
SOAP envelope debugging Legacy banking, insurance, and telco APIs still ship WSDL. A formatted
<soap:Envelope>turns a one-line wire payload into a tree you can actually trace a fault through. -
SAML 2.0 assertion inspection Decoded SSO assertions are dense, namespace-heavy XML. Formatting reveals the
<saml:AttributeStatement>mapping so you can compare what your IdP sent vs. what your SP expected. -
RSS / Atom feeds Feed generators emit unindented output. Formatting before validating with a feed reader reveals missing
<guid>or malformed<pubDate>entries. -
OOXML internals (.docx, .xlsx) Unzip a Word or Excel file and you'll find a tree of XML. Formatting
document.xmlorsheet1.xmlis the only way to debug template-engine output that opens corrupted. -
Android resource files
strings.xml, layout XML, andAndroidManifest.xmlall benefit from consistent indent when you're diffing localization PRs across 30 locales.
04 Worked Examples
<root>
<a:item xmlns:a="urn:catalog">Book</a:item>
<a:item xmlns:a="urn:order">Line 1</a:item>
</root>
<root xmlns:a="urn:catalog">
<a:item>Book</a:item>
<a:item>Line 1</a:item> <!-- now bound to urn:catalog! -->
</root>A correct formatter keeps each xmlns binding local. Per XML Namespaces 1.0, a prefix means whatever it was bound to at its scope, and SAML signature verification will fail loudly if you've silently rebound ds:.
<script><![CDATA[
if (a < b && c > d) doThing();
]]></script><script>
<![CDATA[
if (a < b && c > d) doThing();
]]>
</script>Whitespace around the CDATA section can be normalized; the contents must not be touched, escaped, or re-indented. If a formatter rewrites && to && inside the CDATA, it has a bug, that's exactly the escape CDATA exists to avoid.
<br/>
<br></br><!-- canonicalized form (c14n) always emits explicit close -->
<br></br>XML Signature uses Canonical XML (c14n) to compute the digest. A formatter that rewrites <br/> to <br></br> on a signed assertion breaks the signature, same logical document, different bytes. Format before signing, never after.
05 Related Tools
XML lives next to conversion, schema, and security tools more than any other format. These are the ones we reach for most often.
JSON Formatter
When a SOAP service finally ships a REST gateway, the JSON shape sits next to your old XML payload, format both side-by-side to migrate fields.
Regex Tester
For extracting a single attribute out of a 200-line SAML response when you don't have an XPath tool handy. Format first, then anchor your regex to indentation.
HTML to Markdown
RSS/Atom feed bodies are HTML-in-XML. Once you've formatted the outer feed, run the entry body through this to read it like a human.