XML Formatter
Beautify XML.
Loading tool…
What is XML?
XML — Extensible Markup Language — was standardised by the W3C in 1998 as a general way to describe structured documents with tags you define yourself. It underpins a great deal of infrastructure that is not going anywhere: SOAP web services, RSS feeds, SVG images, Office and OpenDocument files, Android layouts, Maven builds, and countless enterprise integrations.
Unlike JSON, XML distinguishes between elements and attributes, supports namespaces so vocabularies can be mixed in one document, allows comments and processing instructions, and can be validated against a schema. It is also verbose, and machine-generated XML usually arrives with no line breaks at all. Formatting parses the document and re-emits it with consistent indentation, which makes the element hierarchy visible and confirms the document is well-formed at the same time.
Why we built this tool
Anyone integrating with a bank, a government service, a shipping carrier, or an older enterprise system still spends time reading raw XML — usually a SOAP envelope or a settlement file dumped on one line in a log.
Those payloads carry account numbers, personal details, and authentication headers. Pasting them into an online beautifier sends real customer data to a third party for the sake of some indentation. Our formatter parses the XML with the browser's own built-in parser and re-serialises it locally, so the document never leaves the tab. No upload, no size ceiling, no login, and it keeps working offline once the page has loaded.
Tips and common mistakes
- Namespace prefixes are meaningful; do not rename them to tidy the document.
- Whitespace inside mixed-content elements is significant, so formatted output can differ subtly from the original for text-bearing nodes.
- A stray ampersand that should be
&is the most common cause of a well-formedness failure. - Redact authentication headers from SOAP envelopes before sharing them in a ticket.
Open XML Formatter with a link
XML Formatter can be handed its input by the link that opens it, so the page arrives with the work already done. This is meant for assistants and scripts: if a chatbot, an editor extension, or a command-line agent already holds your content, it can build a link instead of asking you to copy and paste into a box.
The payload rides in the fragment — the part of a URL after the #. Browsers never send the fragment to a server, so anything handed over this way stays on your device exactly as a dropped file would. A link that uses the query string instead is rewritten into the fragment by the page before any analytics or ad script can read the address.
Prefix any field with gz — #gztext= — to pass it as gzip-compressed base64url, which fits roughly five to ten times more into the same link. Links stay reliable up to about 8,000 characters; past that, chat apps and address bars start truncating them, and the page says so rather than loading half a document.
One exception to the privacy rule: ?url= tells the page to download the input from an address. That request goes from your browser straight to that server — not through ours — but it does leave your device, and it only works if the server allows cross-origin requests.
With My Gadgets installed as an app, a .xml file opened from your desktop lands straight in this tool. The file is read locally, exactly like a drop.
#text=— the text to work on
Example: https://mygadgets.ink/tools/xml-formatter/#text=...
Quick start: using XML Formatter
- Paste the XML you need to read into the input above.
- Set your preferred indentation width.
- Format the document; parse errors will point at where it is malformed.
- Read the indented structure to find the element you were looking for.
- Copy the formatted XML or download it as a file.
For the JSON equivalent, use JSON Formatter. To compare two documents line by line, try Diff Checker.