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. 1 Paste the XML - a whole feed or a single element.
  2. 2 Pick your indent, then press Format or Minify.
  3. 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.

XML formatting - frequently asked questions

Yes, and those are the two most common reasons to open this page. Both are plain XML, both usually arrive on a single line, and both contain <link> elements - the case an HTML-minded formatter gets wrong. CDATA blocks inside feed items pass through untouched.
New
SQL Formatter Break a long query onto readable lines, or squeeze it back onto one. Keeps your keyword casing, your quoted names and your strings exactly as written.
Popular Today
CSS Minifier Compress CSS by stripping comments and whitespace, or expand it back with clean indentation. Keeps calc() spacing, strings and license comments intact.

Related Dev Tools

JSON Formatter Format, minify and validate JSON in your browser. Broken input is pinpointed by line and column, and a collapsible tree shows the structure.
HTML Formatter Indent messy HTML so you can read it, or strip it down so it ships smaller. Works on fragments too, and never rewrites your markup into something else.
CSS Minifier Compress CSS by stripping comments and whitespace, or expand it back with clean indentation. Keeps calc() spacing, strings and license comments intact.
SQL Formatter Break a long query onto readable lines, or squeeze it back onto one. Keeps your keyword casing, your quoted names and your strings exactly as written.

Other Tools You May Like

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.