Skip to content

XML Minifier

Strip whitespace and optionally comments from XML, and see the bytes saved.

Quick Tool Overview

The XML Minifier removes the indentation and line breaks between elements, optionally strips comments, and reports exactly how many bytes that saved. The parsed document is identical before and after.

What it does
Strips whitespace and optional comments from XML
You give it
A formatted XML document
You get back
The same document on one line, plus the saving
Best for
SOAP bodies, sitemaps, RSS feeds and bundled config
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the XML Minifier

Minifying XML removes the indentation and line breaks between elements, which on a pretty-printed document is often a third of the file. The elements, attributes and text content are untouched — the parsed result is identical.

It matters most for payloads that travel repeatedly: SOAP request bodies, sitemap files, RSS feeds and configuration bundled into an application. Comments can be stripped at the same time, which is usually safe for a machine-read document and is where the remaining savings are. The tool reports the size before and after so you can see whether it was worth it.

Key features of the XML Minifier

Content is never touched

Only whitespace between elements is removed. Text inside an element, which a parser treats as content, is preserved exactly.

Comments optional

Keep them for a document a person reads, or strip them for the smallest payload — usually the larger of the two savings.

The declaration stays

Version and encoding are kept on the first line, because some parsers insist on them.

The saving in numbers

Size before, size after and the percentage removed, so you can tell whether it was worth doing.

Validation comes free

A document that will not minify is a document that will not parse, and the error names the line.

How to use the XML Minifier

  1. 1

    Paste your XML

    Any formatted XML document.

  2. 2

    Decide about comments

    Keep them for a document humans read, or strip them for the smallest payload.

  3. 3

    Check the saving

    The stat row shows the size before, after and the percentage removed.

  4. 4

    Copy or download

    Take the minified document or save it as an .xml file.

Frequently asked questions

Text inside an element is preserved exactly, so content is safe. Only whitespace that sits between elements — which no XML parser treats as content — is removed.

Reviews of the XML Minifier

What people who use the XML Minifier think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the XML Minifier. It takes half a minute and no account.

Write the first review

More developer tools