XML Formatter
Indent, pretty-print, and check your XML for quick readability and confidence
Input
Output
Formatted XML appears here
Paste or type XML in the panel on the left and it is indented as you go.
The XML Formatter
A SOAP response or a WSDL file usually arrives as one line — sometimes a few thousand characters long — because whatever produced it had no reason to add whitespace for a human. XML Formatter takes that line and re-indents it, two spaces per nesting level, one element per line, so you can actually see where <subscriber> ends and the next sibling begins.
It parses your input with the browser's own DOMParser and rebuilds the markup from the parsed tree rather than guessing at bracket positions with regular expressions, which is what lets it catch a genuinely broken document instead of politely reformatting garbage. Text and attribute values come back from the DOM already decoded, so before this tool re-escapes them on the way out, a naive implementation would turn Tom & Jerry into Tom & Jerry — a bare ampersand that no XML parser accepts on the next read. A <![CDATA[...]]> block is left completely alone, because unwrapping its contents would turn literal text into real markup and change what the document means. For the formal rules behind all of this, see the W3C XML 1.0 specification and MDN's XML introduction.
How to Use XML Formatter
- Paste or Upload Your XML – Copy your XML and paste it into the input panel, or click the "Upload" button to load an .xml file from your computer.
- Auto-Format – The tool formats and well-formedness-checks your XML the moment you paste it. No button to press—it just works.
- Review the Output – See your XML properly indented in the output panel, with each element on its own line and clear nesting.
- Copy or Download – Click "Copy" to put the formatted XML on your clipboard, or hit "Download" to save it as an .xml file.
- Minify When Needed – Use the "Minify" button to collapse your XML back into a single line—handy for transport over the wire or embedding in a payload.
Pro Tip: Use Ctrl+V (Cmd+V on Mac) to paste straight into the editor. Formatting happens instantly, and any syntax problem is flagged right away.
Example
A typical telecom provisioning payload: a cramped one-line XML document on the left, the same record pretty-printed on the right.
<?xml version="1.0" encoding="UTF-8"?><subscriber id="SUB-1001"><msisdn>447700900142</msisdn><imsi>234105811234567</imsi><iccid>8944110012345678901</iccid><plan>Unlimited 5G</plan><apn>internet.mno.com</apn><roaming>false</roaming></subscriber>
<?xml version="1.0" encoding="UTF-8"?> <subscriber id="SUB-1001"> <msisdn>447700900142</msisdn> <imsi>234105811234567</imsi> <iccid>8944110012345678901</iccid> <plan>Unlimited 5G</plan> <apn>internet.mno.com</apn> <roaming>false</roaming> </subscriber>
Common Use Cases
Debugging SOAP and API Responses
Many enterprise and telecom systems still speak SOAP, and those envelopes arrive as one continuous string. Trying to find a single field by eye is painful. Format it here and you can instantly see where the body starts, which namespaces are in play, and whether a <soap:Fault> element is hiding inside. For a refresher on the envelope structure, the W3C SOAP specification lays it all out.
Reviewing Configuration Files Before You Commit
Build tools, app servers, and SIM provisioning systems lean heavily on XML config. Indented markup makes a misplaced closing tag or a stray attribute jump out immediately, before it ships. Format both the old and new version the same way first and git diff will only show you the lines that actually changed, instead of a wall of red because the whitespace shifted.
Learning How XML Actually Nests
If you are new to XML or walking a junior engineer through it, indentation makes the tree structure obvious in a way a one-line document never will. Format a real payload, then point at the closing tags and show how each one has to match its opener in reverse order. MDN's XML documentation is a solid next stop once the shape clicks.
Frequently Asked Questions
Is my XML data uploaded anywhere?
No. Formatting runs entirely in your browser through the native DOMParser — nothing is sent to a server, so a payload with a real msisdn or iccid in it never leaves your machine.
What happens if my XML has errors?
The formatter relies on the browser's XML parser, which is strict about well-formedness. If a tag is unclosed, an attribute is unquoted, or the document has no single root element, you will see an "Invalid XML" message with the parser's own line and column instead of formatted output. Fix the structure and it will format cleanly. If you need help, Stack Overflow's XML tag covers thousands of common problems.
Does formatting change the meaning of my XML?
No — it only adds indentation and line breaks. Element names, attribute order and text content come back exactly as you typed them, a <?xml version="1.0" encoding="UTF-8"?> declaration at the top is kept rather than dropped, and a <![CDATA[...]]> block is left as literal text rather than being reinterpreted as markup.
What's the difference between formatting and minifying?
Formatting (beautifying) adds whitespace so the markup is easy for humans to read. Minifying strips the whitespace between tags so the document is as small as possible—useful for transport, storage, or embedding in another payload.
Does this work on mobile devices?
Yes. The tool is fully responsive and works on phones and tablets. The two panels stack vertically on small screens, so you can format XML on the go.