XML Formatter & Minifier
Beautify XML with clean indentation or minify it to one line, in your browser.
How to use
- Paste your XML into the input box.
- Choose Beautify (and an indent size) or Minify.
- Copy the formatted XML from the output box.
About this tool
ShowHide
Paste XML and reformat it instantly — pretty-print it with two spaces, four spaces or tabs, or minify it down to a single line. The document goes through the browser's real XML parser rather than a regular expression, which matters in both directions: a bare ampersand, a mismatched or unclosed tag, or a closing tag whose case does not match is reported as an error instead of being reformatted into something that still will not parse. XML is strict where HTML forgives, so an unclosed br is a genuine error here, not an oversight. Comments, CDATA sections and processing instructions are carried through untouched, and namespace prefixes stay exactly as you wrote them. Everything runs locally in your browser — nothing is uploaded.
Frequently asked questions
What does beautify do?
It re-indents the document by nesting depth so the structure is easy to read, putting each element on its own line. Whitespace between elements is normalized.
What does minify do?
It removes the whitespace between elements and the indentation, collapsing the document to a single line — useful for compact storage or transport.
Does it keep comments and CDATA?
Yes. Comments, CDATA sections and processing instructions are preserved, and special characters in text and attributes are properly escaped.
What if my XML is invalid?
The document is parsed with the browser's XML parser. If it isn't well-formed, an error message is shown instead of broken output.
Is reformatting XML always safe?
Not for every document. Indentation adds whitespace between elements, which is invisible in most formats but is data in a few: mixed content where text sits alongside child elements, and any element carrying xml:space="preserve". Reformat configuration and data files freely; be careful with documents that hold prose.
Why does my HTML fail to parse here?
Because this is an XML parser and HTML is not XML. Unclosed tags like br and img, unquoted attribute values and named entities beyond the five XML defines are all legal HTML and all fatal errors here. That strictness is the point — it catches the mistakes an HTML parser would silently repair.
Related tools
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.
Developer
YAML Formatter & Validator
Pretty-print and validate YAML — fix indentation, sort keys, choose line width, catch errors in place.
Developer
SQL Formatter
Format and beautify SQL across 10 dialects (PostgreSQL, MySQL, BigQuery, Snowflake, T-SQL …).
Developer
Column Aligner — Align Text into Columns
Pad whitespace, comma or tab separated rows into neatly aligned columns, in your browser.
Text
HTML / CSS / JS Minifier
Strip whitespace and comments from HTML, CSS, or JavaScript — see the size saved and copy the result.
Developer
NumPy .npy / .npz Inspector
Read a .npy or .npz header in the browser: dtype, shape, byte order, field layout and a value preview, with no NumPy and no upload.
Developer