XML Formatter and Minifier - Indent or Compress
XML formatter and minifier
What this tool does
XML usually arrives from a machine, on one endless line: an RSS feed, a sitemap, an API response, a config file. This page puts the structure back so you can read it, and takes it away again when you need the small version.
How to use it
- 1 Paste the XML - a whole feed or a single element.
- 2 Pick your indent, then press Format or Minify.
- 3 The text changes in the same box - copy it, or press Undo.
XML is not HTML, and the difference bites
In HTML a handful of elements never close: <link>, <br>, <img>. In XML nothing is special - and <link> appears in every RSS feed on the web, wrapped around a URL. A formatter that carries the HTML rule into XML shifts the indentation by one level from there on and leaves the closing tag stranded. This page turns that rule off.
CDATA is content, not markup
A CDATA section exists precisely so that a chunk of text can contain angle brackets without being parsed. Feeds use it for article HTML all the time. Its body passes through here untouched: no re-indenting, no escaping, no whitespace collapse - because every one of those would change what the consumer of the feed reads.
Whitespace between elements is usually free - inside text it is not
Indentation between two tags means nothing to a parser, so minifying removes it. But in mixed content - text with elements inside it - a space is part of the data, and this tool keeps those. It is a conservative choice: a feed reader showing "onetwo" instead of "one two" is a bug you would never trace back to a formatter.
It formats, it does not validate
A missing closing tag or a stray ampersand will be indented right along with everything else - the tool works on text, not on a parsed document. That is deliberate: a validator that silently repairs your file hides the very thing you opened it to find. If the output looks wrong, look for the mismatch it just made visible.