Skip to main content

Data

XML Minifier

Remove whitespace between XML tags for compact transport.

Runs in your browserPrivate by designXMLXML
XMLXML

Press ⌘ Enter to run

5 lines · 194 chars

Ready — press Run or ⌘ Enter

How this tool handles files

Processing
In your browser, on-device
Storage
Nothing stored
Output
A file you download
Your responsibility
Review before official use
  • Runs in your browser. Your file is processed on your own device and, on this site, is not uploaded to our servers.
  • Nothing is stored. Your file and its output are gone the moment you close or reload the page.
  • Review sensitive files (bank, ID, medical) and check the output before sharing it.

Every tool on FormatOS runs in your browser. Read our Privacy Policy and File Handling Policy.

Common uses

  • Shrink XML payloads
  • Reduce size of stored XML records

Limitations

  • Preserves whitespace inside text nodes

Where a compact XML payload pays off

XML Minifier removes the whitespace that sits between tags, so a pretty-printed document with indentation and line breaks becomes a single dense string. That matters most when XML is moving or being stored rather than read: SOAP and REST request bodies, RSS and Atom feeds, sitemaps, configuration blobs, and SVG markup all shrink when their formatting whitespace is gone, which trims bytes over the wire and in caches.

For developers it is a quick step before committing a generated fixture, embedding XML inside another payload, or comparing two documents where indentation differences are noise. For data prep and archiving it reduces the footprint of stored XML records and the size of XML files you are about to add to a zip. Because it runs entirely in your browser, you can paste internal API responses or configuration without that text leaving the tab, and nothing is retained once the tab closes.

The paste-process-copy flow

Add your XML by pasting it into the input or selecting a file, run the minify step, then copy the result or download it. Input and output are both XML; the tool does not change the markup's meaning, only its layout. The transform collapses runs of whitespace that fall between a closing angle bracket and the next opening one, then trims leading and trailing whitespace from the whole document.

What it deliberately leaves alone is as important as what it removes. Whitespace inside text nodes is preserved, so the readable content of elements stays intact. Attribute values, tag and attribute names, the XML declaration, and the document's structure are untouched. It is a text-level operation, not a parser: it does not pretty-print, re-encode entities, strip comments, remove namespaces, or rewrite self-closing tags. If you need the reverse, a separate XML Formatter re-indents minified markup.

Where it can bite you

Because the tool matches the pattern between tags rather than parsing a tree, mixed content is the main hazard. In markup like a paragraph that wraps text around an inline element, the spaces separating words from inner tags can be significant, and collapsing them may join words or alter rendering. The same caution applies to whitespace-sensitive formats and to any element where indentation is actually meaningful, such as content inside an XML wrapper that carries pre-formatted text.

Two more things to expect. The tool does not validate, so malformed XML passes through largely unchanged and you will not get an error pointing at the problem. And whitespace held inside text nodes is preserved by design, so if your goal was to strip indentation that lives within an element's text, this minifier will not do that. Treat it as a safe size reducer for well-formed, structure-only whitespace, not a general cleanup pass.

Checking the output before you ship it

Confirm the output still opens and parses in whatever consumes it: load it in a browser, an XML viewer, or your application and check there are no new parse errors. Scan any mixed-content sections to be sure words did not run together where an inline tag used to be padded by spaces, and verify that the XML declaration, namespaces, and attribute values came through unchanged. A quick spot-check that element text reads correctly is usually enough to catch the common problems.

For official, financial, or legal XML, do not rely on a visual glance alone. Validate the minified document against its schema or DTD and, where possible, diff it against the original after re-formatting both, so you can confirm the only difference is inter-tag whitespace. Keep the source file until that verification passes, since the minified form is harder to read if you later need to audit it.

Frequently asked questions

The whitespace and line breaks between tags. The element structure, attributes, and text content all stay the same — the document is just smaller.

Whitespace inside a text node is preserved, since changing it could alter your content. Only the gaps between tags are collapsed.

Yes. Run the minified XML through the XML Formatter to get a readable, indented version back.

No. The conversion runs in your browser — your text or file is processed on your own device and, on this site, is not uploaded to a server, and we do not intentionally store it.

Related data tools

Tool last reviewed: June 30, 2026 · Report a problem