XML Formatter
Format and indent XML for readability, or minify it down to a single line, instantly inside your browser.
Why format XML?
XML pulled from an API response, a config file, or a log is often either minified onto a single unreadable line, or inconsistently indented from manual editing. This tool parses the XML and re-serializes it with consistent indentation, or strips all unnecessary whitespace down to a compact single line.
GuideHow to use it
How the formatting works
The XML is parsed using the browser's native XML parser, which validates it in the process — if the XML is malformed, a clear error is shown instead of a broken result. Once parsed, it's re-serialized with each element on its own line, indented based on its nesting depth. Minify mode instead strips all whitespace between tags down to a single compact line.
Why it helpsFeatures & benefits
Why this runs entirely in your browser
Parsing and formatting run in JavaScript locally in the tab, which means it keeps working offline once the page has loaded and nothing pasted here is ever sent to a server.
Common uses
Making a minified API response readable for debugging, cleaning up an inconsistently formatted config file, or shrinking an XML payload before sending it somewhere size-sensitive.
Frequently asked questions
A few things people usually want to know before trusting the numbers.
Yes — the XML is parsed using the browser's native XML parser, which reports an error if the document isn't well-formed.
No. Formatting only affects whitespace and line breaks between tags — element names, attributes, and text content are preserved exactly.
Yes — namespaced elements and attributes are parsed and re-serialized correctly.
HTML isn't always valid XML (it allows unclosed tags XML doesn't), so use a dedicated HTML tool for HTML — this tool expects well-formed XML.
No. All formatting happens locally in your browser. Nothing pasted here is sent to a server, stored, or shared.