XML Formatter
Paste XML to pretty-print it with correct nesting indentation, or strip it down to a minified single line. DOCTYPE and ENTITY declarations are rejected outright as a security precaution against XXE attacks — the file is never parsed by a real XML engine, only checked as text.
The text is processed entirely on your device and is never sent to any server.
This tool doesn't process DOCTYPE or ENTITY for security reasons (preventing XXE attacks), and doesn't parse the file through a real XML engine — only a simple text check of tag balance.
Result
—
What this tool does
Reformats XML with indentation that shows how elements nest, or minifies it to a single line.
When to use it
- An XML file or response that arrived minified onto one line.
- Inspecting the structure of an XML document you do not know.
- Finding an element in a large file and needing to see the nesting.
- Minifying XML before sending it to reduce its size.
How to use it
- Paste the XML into the field.
- Click format or minify.
- Copy the result.
A practical example
Input
An XML document on one line with nested elements.
Output
The same document with each element on its own line, indented to match its depth so the nesting is obvious.
Limitations
- The input must be well-formed XML; anything else is rejected with a clear message.
- This formats and does not validate the document against any schema.
- Whitespace inside text content can be affected by formatting, which matters in documents where whitespace is significant.
Privacy and processing
The XML stays on your device and is never sent to any server.
Technical notes
- Formatting preserves the document's structure and reorders neither elements nor attributes.