Format or minify XML without losing comments, CDATA or attribute order. Only whitespace changes. Free, runs in your browser.
First time here? Paste your XML Your input is processed locally and disappears when you close the tab.
XML arrives from APIs and exports as one enormous line, and reading it is impossible until it has been indented. This free xml formatter online fixes that, and does it without changing anything except whitespace.\n\nThat distinction matters more than it sounds. Many formatters parse XML into an object tree and serialise it back out, which silently drops comments, mangles CDATA sections, discards processing instructions and reorders attributes. This one walks the document as tokens and re-indents in place, so what comes out is byte-identical apart from the whitespace you asked to change.\n\nShort elements are collapsed onto a single line, so a name element containing a few words does not sprawl across three. Indentation is configurable to two spaces, four, or tabs to match whatever your project uses, and a minify mode strips inter-tag whitespace when you need the smallest possible payload.\n\nMalformed input is rejected rather than silently mangled, with the browser's own parser diagnosis included where available — usually pointing straight at the unclosed tag. Everything runs locally. Pair it with the XML to JSON Converter when you need to work with the data rather than read it, or the Sitemap Generator if the XML in question is a sitemap.
Paste your XML
Choose format or minify
Pick an indent width
Copy or download the result
Only whitespace changes. Formatting re-indents the document without parsing it into an object and rebuilding it, so comments, processing instructions, CDATA sections and attribute order all survive exactly as written. Tools that round-trip through a parser routinely lose all four.
Short elements like <name>Desk lamp</name> are collapsed onto one line, which is the convention most people expect.