Free online XML formatter. Pretty-print and indent messy XML, minify it, and check it is well-formed — instantly and privately in your browser.
XML is easy for machines to read but quickly becomes unreadable for humans once it is minified onto a single line. This tool takes messy or compacted XML and pretty-prints it with clean, consistent indentation so the nesting structure is obvious at a glance. It can also do the reverse — minify XML by stripping the whitespace between tags to produce the smallest possible payload for transmission or storage.
Paste your XML into the input box. Choose Beautify to format it, and pick your indentation (2 spaces, 4 spaces, or a tab). Switch to Minify to collapse it back down. The formatted result appears immediately in the output panel with a one-click copy button. A status banner above the panels tells you whether the document is well-formed, and if not, shows the parser error so you can find the problem.
Formatting only changes whitespace — it never alters your data, attribute values, or element order. Validation is separate: the tool uses your browser's built-in XML parser to confirm the document is well-formed (every tag closed, properly nested, one root element). Note that well-formed is not the same as valid against a schema — this tool checks structure, not conformance to a DTD or XSD.
The formatter understands and keeps intact the XML declaration (<?xml ?>), processing instructions, comments (<!-- -->), CDATA sections, and DOCTYPE declarations. Self-closing tags and short text-only elements such as <price>44.95</price> are kept on a single line to avoid needless sprawl. Because all processing happens locally in your browser, sensitive XML such as SOAP messages, config files, or API responses never leaves your machine.
Beautify adds line breaks and indentation so the XML is easy to read. Minify removes the whitespace between tags to make the file as small as possible for transfer or storage. Neither changes your actual data.
It checks whether your XML is well-formed using the browser's native parser — meaning every tag is closed, properly nested, and there is a single root element. If something is wrong, it shows the parser error. It does not validate against a DTD or XSD schema.
No. Formatting, minifying, and validation all run locally in your browser with JavaScript. Your XML is never sent anywhere, which makes it safe for config files and private API payloads.
Yes. In Beautify mode you can format with 2 spaces, 4 spaces, or tabs, depending on your project's style conventions.