100% client-side, nothing ever leaves your browser
Format & Validate XML
Paste XML to validate it, pretty-print it with your choice of indentation, or minify it down to a single compact line — instantly, in your browser.
How XML formatting works
Your XML is parsed with the browser's native DOMParser, then rebuilt as indented or minified text — entirely inside your browser.
Paste your XML
The document is parsed immediately, and any well-formedness errors are shown right away.
Choose format or minify
Pretty-print with your chosen indentation, or collapse the document into a compact single line.
Copy or download
Copy the result to your clipboard or download it as an .xml file.
Privacy note: parsing and formatting happen entirely in your browser using the native DOMParser. Your XML is never uploaded, logged, or stored on a server.
Common uses
Debugging API responses
Format a compact XML response from a SOAP or REST API into a readable, indented structure.
Cleaning up config files
Reformat inconsistently indented configuration or build files, like Maven POMs or Android manifests, for readability.
Shrinking XML for transport
Minify XML before embedding it or sending it over the network to reduce payload size.
Checking well-formedness
Quickly confirm whether a snippet of XML is valid before pasting it into code or a config file.
Frequently asked questions
How does this tool validate XML?
It uses your browser's built-in DOMParser to parse the XML exactly as a browser would. If the document is not well-formed, the parser's own error message is shown, typically including the line and character where parsing failed.
What indentation options are available?
You can format with 2 spaces, 4 spaces, or a tab character per indentation level.
Does formatting change mixed text and element content?
Elements containing only text keep that text on the same line as their tags. Elements that mix text with child elements are reformatted onto separate lines for readability, which can alter insignificant inline whitespace in rare mixed-content documents.
What does minify do?
Minify removes formatting whitespace between tags and outputs the same document as compactly as possible, while preserving all elements, attributes, and text content.
Is my XML uploaded anywhere?
No. Parsing, formatting, and minifying all happen locally in your browser. Nothing you paste is sent to a server.
Does this support an XML declaration and comments?
Yes. A leading <?xml ...?> declaration is preserved at the top of the output, and comments in the document are kept in place during both formatting and minifying.
More tools
Additional utilities from the same toolkit.